Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#473)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 22.12.0 → 23.1.0](psf/black@22.12.0...23.1.0)
- [github.com/PyCQA/isort: 5.11.4 → 5.12.0](PyCQA/isort@5.11.4...5.12.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] committed Feb 7, 2023
1 parent 65d25e0 commit 53dd3e2
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ci:

repos:
- repo: https://github.com/psf/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black

Expand All @@ -15,7 +15,7 @@ repos:
args: [--py37-plus]

- repo: https://github.com/PyCQA/isort
rev: 5.11.4
rev: 5.12.0
hooks:
- id: isort
additional_dependencies: [toml]
Expand Down
1 change: 0 additions & 1 deletion src/towncrier/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


def __getattr__(name: str) -> Version:

if name != "__version__":
raise AttributeError(f"module {__name__} has no attribute {name}")

Expand Down
6 changes: 1 addition & 5 deletions src/towncrier/_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def find_fragments(
orphan_fragment_counter: DefaultDict[str | None, int] = defaultdict(int)

for key, val in sections.items():

if fragment_directory is not None:
section_dir = os.path.join(base_directory, val, fragment_directory)
else:
Expand All @@ -113,7 +112,6 @@ def find_fragments(
file_content = {}

for basename in files:

ticket, category, counter = parse_newfragment_basename(
basename, frag_type_names
)
Expand Down Expand Up @@ -149,6 +147,7 @@ def indent(text: str, prefix: str) -> str:
"""
Adds `prefix` to the beginning of non-empty lines in `text`.
"""

# Based on Python 3's textwrap.indent
def prefixed_lines() -> Iterator[str]:
for line in text.splitlines(True):
Expand All @@ -165,14 +164,12 @@ def split_fragments(
definitions: Mapping[str, Mapping[str, Any]],
all_bullets: bool = True,
) -> Mapping[str, Mapping[str, Mapping[str, Sequence[str]]]]:

output = OrderedDict()

for section_name, section_fragments in fragments.items():
section: dict[str, dict[str, list[str]]] = {}

for (ticket, category, counter), content in section_fragments.items():

if all_bullets:
# By default all fragmetns are append by "-" automatically,
# and need to be indented because of that.
Expand Down Expand Up @@ -261,7 +258,6 @@ def render_fragments(
data: dict[str, dict[str, dict[str, list[str]]]] = OrderedDict()

for section_name, section_value in fragments.items():

data[section_name] = OrderedDict()

for category_name, category_value in section_value.items():
Expand Down
1 change: 0 additions & 1 deletion src/towncrier/_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ def remove_files(fragment_filenames: list[str]) -> None:


def stage_newsfile(directory: str, filename: str) -> None:

call(["git", "add", os.path.join(directory, filename)])


Expand Down
3 changes: 0 additions & 3 deletions src/towncrier/_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


def _get_package(package_dir: str, package: str) -> ModuleType:

try:
module = import_module(package)
except ImportError:
Expand All @@ -39,7 +38,6 @@ def _get_package(package_dir: str, package: str) -> ModuleType:


def get_version(package_dir: str, package: str) -> str:

module = _get_package(package_dir, package)

version = getattr(module, "__version__", None)
Expand Down Expand Up @@ -68,7 +66,6 @@ def get_version(package_dir: str, package: str) -> str:


def get_project_name(package_dir: str, package: str) -> str:

module = _get_package(package_dir, package)

version = getattr(module, "__version__", None)
Expand Down
1 change: 0 additions & 1 deletion src/towncrier/_settings/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def load_config_from_options(


def load_config(directory: str) -> Config | None:

towncrier_toml = os.path.join(directory, "towncrier.toml")
pyproject_toml = os.path.join(directory, "pyproject.toml")

Expand Down
1 change: 0 additions & 1 deletion src/towncrier/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def _main(compare_with: str | None, directory: str | None, config: str | None) -
def __main(
comparewith: str | None, directory: str | None, config_path: str | None
) -> None:

base_directory, config = load_config_from_options(directory, config_path)

if comparewith is None:
Expand Down
1 change: 0 additions & 1 deletion src/towncrier/test/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

class FormatterTests(TestCase):
def test_split(self):

fragments = {
"": {
("1", "misc", 0): "",
Expand Down
1 change: 0 additions & 1 deletion src/towncrier/test/test_write.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class WritingTests(TestCase):
maxDiff = None

def test_append_at_top(self):

fragments = OrderedDict(
[
(
Expand Down

0 comments on commit 53dd3e2

Please sign in to comment.