Skip to content

Commit

Permalink
chore: update version strings
Browse files Browse the repository at this point in the history
  • Loading branch information
weibullguy committed Jun 10, 2023
1 parent 7502a15 commit 9ed7943
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
project = "docformatter"
copyright = "2022-2023, Steven Myint"
author = "Steven Myint"
release = "1.7.3-alpha"
release = "1.7.3-rc1"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
8 changes: 7 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "docformatter"
version = "1.7.3-alpha"
version = "1.7.3-rc1"
description = "Formats docstrings to follow PEP 257"
authors = ["Steven Myint"]
maintainers = [
Expand Down Expand Up @@ -99,6 +99,12 @@ non-cap = [
"docformatter",
]

[tool.mypy]
allow_subclassing_any = true
follow_imports = "skip"
implicit_reexport = true
ignore_missing_imports = true

[tool.pydocstyle]
convention = "pep257"

Expand Down
2 changes: 1 addition & 1 deletion src/docformatter/__pkginfo__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@
# SOFTWARE.
"""Package information for docformatter."""

__version__ = "1.7.3-alpha"
__version__ = "1.7.3-rc1"
19 changes: 9 additions & 10 deletions src/docformatter/encode.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
import io
import locale
import sys
from typing import Dict, List
from os import PathLike
from typing import Any, Dict, List

# Third Party Imports
from charset_normalizer import from_path # pylint: disable=import-error
Expand All @@ -46,11 +47,9 @@ class Encoder:
def __init__(self):
"""Initialize an Encoder instance."""
self.encoding = "latin-1"
self.system_encoding = (
locale.getpreferredencoding() or sys.getdefaultencoding()
)
self.system_encoding = locale.getpreferredencoding() or sys.getdefaultencoding()

def do_detect_encoding(self, filename: str) -> None:
def do_detect_encoding(self, filename: PathLike[Any]) -> None:
"""Return the detected file encoding.
Parameters
Expand All @@ -67,7 +66,7 @@ def do_detect_encoding(self, filename: str) -> None:
except (SyntaxError, LookupError, UnicodeDecodeError):
self.encoding = "latin-1"

def do_find_newline(self, source: List[str]) -> Dict[int, int]:
def do_find_newline(self, source: List[str]) -> str:
"""Return type of newline used in source.
Parameters
Expand All @@ -77,12 +76,12 @@ def do_find_newline(self, source: List[str]) -> Dict[int, int]:
Returns
-------
counter : dict
A dict with the count of new line types found.
newline : str
The most prevalent new line type found.
"""
assert not isinstance(source, unicode)

counter = collections.defaultdict(int)
counter: Dict[str, int] = collections.defaultdict(int)
for line in source:
if line.endswith(self.CRLF):
counter[self.CRLF] += 1
Expand All @@ -93,7 +92,7 @@ def do_find_newline(self, source: List[str]) -> Dict[int, int]:

return (sorted(counter, key=counter.get, reverse=True) or [self.LF])[0]

def do_open_with_encoding(self, filename: str, mode: str = "r"):
def do_open_with_encoding(self, filename: PathLike[Any], mode: str = "r"):
"""Return opened file with a specific encoding.
Parameters
Expand Down

0 comments on commit 9ed7943

Please sign in to comment.