Skip to content
This repository has been archived by the owner on Jul 26, 2024. It is now read-only.

Commit

Permalink
Remove unused commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauko Quiroga committed Oct 17, 2021
1 parent 1d1416b commit 3ae1627
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 40 deletions.
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ ignore =
WPS306,
WPS318,
WPS347,
WPS348,
WPS412,
WPS428,
WPS431,
Expand Down
5 changes: 0 additions & 5 deletions src/pysemver/actions/_build_signatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def _build_unique_name(
return _build_unique_name(path, node, suffixes, signatures)


# @deal.pure
def _build_posarg(node: ast.FunctionDef) -> Callable[..., Any]:
"""Curryfies the positional arguments builder."""

Expand All @@ -78,7 +77,6 @@ def _build_posarg(node: ast.FunctionDef) -> Callable[..., Any]:
)


# @deal.pure
def _build_keyarg(node: ast.FunctionDef) -> Callable[..., Any]:
"""Curryfies the keyword arguments builder."""

Expand All @@ -89,7 +87,6 @@ def _build_keyarg(node: ast.FunctionDef) -> Callable[..., Any]:
)


# @deal.pure
def _build_argument(
acc: Tuple[Argument, ...],
node: ast.arg,
Expand Down Expand Up @@ -119,8 +116,6 @@ def _build_argument(
return (*acc, argument)


# @deal.raises(IndexError)
# @deal.has()
def _build_arg_default(
n_acc: int,
n_arg: int,
Expand Down
3 changes: 0 additions & 3 deletions src/pysemver/actions/_bump_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,13 @@ def __init__(self) -> None:
self.required = Version.Int.NONE

@deal.pure
# @typic.al(strict = True)
def __call__(self, bump: int) -> None:
"""Bumps the required version."""

index = max(self.required.value, Version.Int(bump).value)
self.required = Version.Int(index)

@deal.pure
# @typic.al(strict = True)
def is_acceptable(self) -> bool:
"""Determines if the current version is acceptable or not.
Expand Down Expand Up @@ -123,7 +121,6 @@ def is_acceptable(self) -> bool:
return actual_number >= before_number

@deal.pure
# @typic.al(strict = True)
def _extract(self, version: str) -> Tuple[int, bool]:
"""Extract a major/minor/patch number from a version string."""

Expand Down
21 changes: 6 additions & 15 deletions src/pysemver/actions/_check_deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@
"""Deprecation checker."""

from types import ModuleType
from typing import Sequence
from typing import Sequence, Tuple

import ast
import pathlib
import textwrap

import deal
import typic

from .. import infra, utils
Expand All @@ -21,11 +20,11 @@
_version: str
_version = infra.repo.versions.last()

_files: Sequence[str]
_files: Tuple[str, ...]
_files = infra.repo.files.tree(_version)


# @typic.klass(always = True, strict = True)
@typic.klass(always = True, strict = True)
class CheckDeprecated(ast.NodeVisitor):
"""Prints the list of features marked as deprecated.
Expand Down Expand Up @@ -57,13 +56,11 @@ class CheckDeprecated(ast.NodeVisitor):
count: int
exit: Exit
files: Sequence[str]
nodes: Sequence[ast.Module]
nodes: Tuple[ast.Module, ...]
total: int
version: str
ignore: Sequence[str]
ignore: Tuple[str, ...]

# @deal.pure
# @typic.al(strict = True)
def __init__(
self,
logs: ModuleType,
Expand All @@ -85,7 +82,6 @@ def __init__(
self.total = len(self.nodes)
self.version = version

# @deal.pure
def __call__(self) -> None:
"""Check fro deprecated features."""

Expand All @@ -100,7 +96,6 @@ def __call__(self) -> None:

self.logs.wipe()

# @deal.pure
def visit_FunctionDef(self, node: ast.FunctionDef) -> None:
"""Defines the ``visit()`` function to inspect the ``node``.
Expand Down Expand Up @@ -129,7 +124,7 @@ def visit_FunctionDef(self, node: ast.FunctionDef) -> None:
"""

keywords: Sequence[str]
keywords: Tuple[str, ...]
file: str
path: pathlib.Path
module: str
Expand Down Expand Up @@ -188,13 +183,9 @@ def visit_FunctionDef(self, node: ast.FunctionDef) -> None:

self.logs.then()

# @deal.pure
# @typic.al(strict = True)
def _isthis(self, version: str) -> bool:
return self.version == version

# @deal.pure
# @typic.al(strict = True)
def _node(self, file: str) -> ast.Module:
source: str

Expand Down
20 changes: 5 additions & 15 deletions src/pysemver/actions/_check_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,9 @@
from types import ModuleType
from typing import Optional, Set, Tuple, TypeVar

import deal
import typic

from ..domain import Exit, Signature
from ..domain import Signature, Version
from ..types import What
from ._bump_version import BumpVersion
from ._parse_files import ParseFiles
Expand All @@ -24,7 +23,7 @@
PARSER = ParseFiles(this = "HEAD")


# @typic.klass(always = True, slots = True, strict = True)
@typic.klass(always = True, slots = True, strict = True)
class CheckVersion:
"""Checks if the current version is acceptable.
Expand All @@ -39,24 +38,22 @@ class CheckVersion:
"""

logs: ModuleType
exit: Exit
exit: Version.Int
parser: ParseFiles
ignore: Tuple[str, ...]
bump_version: BumpVersion

# @typic.al(strict = True)
def __init__(
self,
logs: ModuleType,
ignore: Tuple[str, ...],
parser: ParseFiles = PARSER) -> None:
self.logs = logs
self.ignore = ignore
self.exit = Exit.OK
self.exit = Version.Int.NONE
self.parser = parser
self.bump_version = BumpVersion()

# @deal.pure
def __call__(self) -> None:
"""Runs all the checks."""

Expand All @@ -73,8 +70,6 @@ def __call__(self) -> None:
.logs.then()
)

# @deal.pure
# @typic.al(strict = True)
def _parse(self, parser: ParseFiles, what: What) -> Tuple[Signature, ...]:
"""Updates status while the parser builds signatures."""

Expand All @@ -89,7 +84,6 @@ def _parse(self, parser: ParseFiles, what: What) -> Tuple[Signature, ...]:

return parser.signatures

# @deal.pure
def _check_files(self: T, bump_version: BumpVersion, files: Set[str]) -> T:
"""Requires a bump if there's a diff in files."""

Expand All @@ -113,7 +107,6 @@ def _check_files(self: T, bump_version: BumpVersion, files: Set[str]) -> T:

return self

# @deal.pure
def _check_funcs(
self: T,
bump_version: BumpVersion,
Expand Down Expand Up @@ -173,7 +166,6 @@ def _check_funcs(

return self

# @deal.pure
def _check_version_acceptable(self: T, bump_version: BumpVersion) -> T:
"""Requires a bump if there current version is not acceptable."""

Expand All @@ -182,15 +174,13 @@ def _check_version_acceptable(self: T, bump_version: BumpVersion) -> T:
self.logs.okay(f"Current version: {bump_version.this}")

if bump_version.is_acceptable():
self.exit = Exit.OK
self.exit = Version.Int.NONE
return self

self.logs.fail()

return self

# @deal.pure
# @typic.al(strict = True)
def _is_functional(self, file: str) -> bool:
"""Checks if a given ``file`` is whitelisted as functional."""

Expand Down
2 changes: 0 additions & 2 deletions src/pysemver/actions/_parse_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ class ParseFiles:
builder: Optional[BuildSignatures]
signatures: Optional[Tuple[Signature, ...]]

# @deal.pure
# @typic.al(strict = True)
def __init__(self, *, this: str = _this, that: str = _that) -> None:
self.this = this
self.that = that
Expand Down

0 comments on commit 3ae1627

Please sign in to comment.