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

Drop Python 3.6 support #22

Merged
merged 3 commits into from
Nov 15, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ['pypy-3.7', '3.6', '3.7', '3.8', '3.9', '3.10', '3.11-dev']
python-version: ['pypy-3.7', '3.7', '3.8', '3.9', '3.10', '3.11-dev']
os: [ubuntu-latest, macos-latest, windows-latest]
continue-on-error: ${{ matrix.python-version == '3.11-dev' }}

Expand All @@ -56,7 +56,7 @@ jobs:
pytest --cov --cov-fail-under=100

- name: Report coverage
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.6'
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'
uses: codecov/codecov-action@v2

allgood:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 1.0.0 (unreleased)

- Removed
- Support for Python 3.6

## 0.4.0

- Added
Expand Down
9 changes: 4 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ authors = [
{ name = "Taneli Hukkinen", email = "hukkin@users.noreply.github.com" },
]
license = { file = "LICENSE" }
requires-python = ">=3.6"
requires-python = ">=3.7"
readme = "README.md"
classifiers = [
"License :: OSI Approved :: MIT License",
"Operating System :: MacOS",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
Expand Down Expand Up @@ -66,17 +65,17 @@ xfail_strict = true
legacy_tox_ini = '''
[tox]
# Only run pytest envs when no args given to tox
envlist = py{36,37,38,39,310}
envlist = py{37,38,39,310}
isolated_build = True

[testenv:py{36,37,38,39,310}]
[testenv:py{37,38,39,310}]
description = run tests against unpackaged source
skip_install = True
deps = -r tests/requirements.txt
commands =
pytest {posargs}

[testenv:py{36,37,38,39,310}-package]
[testenv:py{37,38,39,310}-package]
description = run tests against a built package
deps = -r tests/requirements.txt
commands =
Expand Down
23 changes: 8 additions & 15 deletions tomli_w/_writer.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
from __future__ import annotations

from collections.abc import Generator, Mapping
from datetime import date, datetime, time
from decimal import Decimal
import string
from types import MappingProxyType
from typing import (
Any,
BinaryIO,
Dict,
Generator,
List,
Mapping,
NamedTuple,
Tuple,
Union,
)
from typing import Any, BinaryIO, NamedTuple

ASCII_CTRL = frozenset(chr(i) for i in range(32)) | frozenset(chr(127))
ILLEGAL_BASIC_STR_CHARS = frozenset('"\\') | ASCII_CTRL - frozenset("\t")
Expand All @@ -33,13 +26,13 @@
)


def dump(obj: Dict[str, Any], fp: BinaryIO, *, multiline_strings: bool = False) -> None:
def dump(obj: dict[str, Any], fp: BinaryIO, *, multiline_strings: bool = False) -> None:
opts = Opts(multiline_strings)
for chunk in gen_table_chunks(obj, opts, name=""):
fp.write(chunk.encode())


def dumps(obj: Dict[str, Any], *, multiline_strings: bool = False) -> str:
def dumps(obj: dict[str, Any], *, multiline_strings: bool = False) -> str:
opts = Opts(multiline_strings)
return "".join(gen_table_chunks(obj, opts, name=""))

Expand All @@ -57,7 +50,7 @@ def gen_table_chunks(
) -> Generator[str, None, None]:
yielded = False
literals = []
tables: List[Tuple[str, Any, bool]] = [] # => [(key, value, inside_aot)]
tables: list[tuple[str, Any, bool]] = [] # => [(key, value, inside_aot)]
for k, v in table.items():
if isinstance(v, dict):
tables.append((k, v, False))
Expand Down Expand Up @@ -127,7 +120,7 @@ def format_inline_table(obj: dict, opts: Opts) -> str:
)


def format_inline_array(obj: Union[tuple, list], opts: Opts, nest_level: int) -> str:
def format_inline_array(obj: tuple | list, opts: Opts, nest_level: int) -> str:
if not obj:
return "[]"
item_indent = ARRAY_INDENT * (1 + nest_level)
Expand Down