Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace typing-extensions Literal with the type of the Literal #677

Merged
merged 6 commits into from
Oct 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ python:
- "3.8"
- "3.9"
install:
- pip install tox==3.14.0 tox-travis flake8
- pip install tox tox-travis
script:
- tox -r
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Support for Python 3.4 and 3.5 ([#522](https://github.com/pdfminer/pdfminer.six/pull/522))
- Unused dependency on `sortedcontainers` package ([#525](https://github.com/pdfminer/pdfminer.six/pull/525))
- Support for non-standard output streams that are not binary ([#523](https://github.com/pdfminer/pdfminer.six/pull/523))
- Dependency on typing-extensions introduced by [#661](https://github.com/pdfminer/pdfminer.six/pull/661) ([#677](https://github.com/pdfminer/pdfminer.six/pull/677))

## [20201018]

Expand Down
5 changes: 2 additions & 3 deletions pdfminer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from typing import (Any, BinaryIO, Callable, Dict, Generic, Iterable, Iterator,
List, Optional, Set, TextIO, Tuple, TypeVar, Union,
TYPE_CHECKING, cast)
from typing_extensions import Literal
from html import escape

if TYPE_CHECKING:
Expand Down Expand Up @@ -55,10 +54,10 @@ def __exit__(
exc_type: object,
exc_val: object,
exc_tb: object
) -> Literal[False]:
) -> None:
if self.closing:
self.file_handler.close()
return False
return


def make_compat_bytes(in_str: str) -> bytes:
Expand Down
3 changes: 1 addition & 2 deletions tools/pdf2txt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import logging
import sys
from typing import Any, Container, Iterable, List, Optional, Union
from typing_extensions import Literal

import pdfminer.high_level
from pdfminer.layout import LAParams
Expand All @@ -18,7 +17,7 @@
(".xml", "xml"),
(".tag", "tag"))

FloatOrDisabled = Union[float, Literal["disabled"]]
FloatOrDisabled = Union[float, str] # Union[float, Literal["disabled"]]


def float_or_disabled(x: str) -> FloatOrDisabled:
Expand Down
32 changes: 25 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
[tox]
envlist = py{36,37,38,3.9}
envlist = py{36,37,38,39}-{nose,flake8,mypy,docs}

[testenv]
extras =
dev
docs
whitelist_externals =
[testenv:py{36,37,38,39}-nose]
deps =
nose
allowlist_externals =
nosetests
commands =
nosetests --nologcapture

[testenv:py{36,37,38,39}-flake8]
deps =
flake8
allowlist_externals =
flake8
commands =
flake8 pdfminer/ tools/ tests/ --count --statistics

[testenv:py{36,37,38,39}-mypy]
deps =
mypy
allowlist_externals =
mypy
commands =
mypy --install-types --non-interactive --show-error-codes .
nosetests --nologcapture

[testenv:py{36,37,38,39}-docs]
extras =
docs
commands =
python -m sphinx -b html docs/source docs/build/html
python -m sphinx -b doctest docs/source docs/build/doctest