Skip to content

Commit 77e46f0

Browse files
rafalkrupinskiRaphael Krupinski
and
Raphael Krupinski
authored
chore: run pyupgrade --py38-plus, remove mentions of lower python versions (#47)
* chore: Run pyupgrade --py38-plus, remove mentions of lower python versions. * chore: python support - add 3.11, 3.12, pypy 3.9 and pypy 3.10 * chore: remove unused travis config. * chore: bring back python 3.7 (no code change) * readme: remove broken link to travis badge --------- Co-authored-by: Raphael Krupinski <10319569-mattesilver@users.noreply.gitlab.com>
1 parent 5427072 commit 77e46f0

File tree

6 files changed

+15
-47
lines changed

6 files changed

+15
-47
lines changed

.github/workflows/run-test.yaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ jobs:
1212
strategy:
1313
matrix:
1414
python-version:
15-
- "3.5"
16-
- "3.6"
1715
- "3.7"
1816
- "3.8"
1917
- "3.9"
2018
- "3.10"
19+
- "3.11"
20+
- "3.12"
2121
- "pypy-3.7"
22+
- "pypy-3.8"
23+
- "pypy-3.9"
24+
- "pypy-3.10"
2225

2326
fail-fast: false
2427

.travis.yml

-33
This file was deleted.

README.rst

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
Python-MimeParse
22
================
33

4-
.. image:: https://travis-ci.org/dbtsai/python-mimeparse.svg?branch=master
5-
:target: https://travis-ci.org/dbtsai/python-mimeparse
6-
74
This module provides basic functions for handling mime-types. It can
85
handle matching mime-types against a list of media-ranges. See section
96
5.3.2 of the HTTP 1.1 Semantics and Content specification [RFC 7231] for
@@ -18,7 +15,7 @@ Use **pip**:
1815
1916
$ pip install python-mimeparse
2017
21-
It supports Python 2.7, 3.4+ and PyPy.
18+
It supports Python 3.7+ and PyPy.
2219

2320
Functions
2421
---------
@@ -47,7 +44,7 @@ Choose the mime-type with the highest quality ("q") from a list of candidates.
4744
Testing
4845
-------
4946

50-
Run the tests by typing: ``python mimeparse_test.py``. The tests require Python 2.6.
47+
Run the tests by typing: ``python mimeparse_test.py``.
5148

5249
To make sure that the package works in all the supported environments, you can
5350
run **tox** tests:

mimeparse.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def parse_mime_type(mime_type):
6868
type_parts = full_type.split('/') if '/' in full_type else None
6969
if not type_parts or len(type_parts) > 2:
7070
raise MimeTypeParseException(
71-
"Can't parse type \"{}\"".format(full_type))
71+
f"Can't parse type \"{full_type}\"")
7272

7373
(type, subtype) = type_parts
7474

mimeparse_test.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@
2020
class MimeParseTestCase(unittest.TestCase):
2121

2222
def setUp(self):
23-
super(MimeParseTestCase, self).setUp()
23+
super().setUp()
2424
with open("testdata.json") as f:
2525
self.test_data = json.load(f)
2626

2727
def _test_parse_media_range(self, args, expected):
2828
expected = tuple(expected)
2929
result = mimeparse.parse_media_range(args)
30-
message = "Expected: '%s' but got %s" % (expected, result)
30+
message = f"Expected: '{expected}' but got {result}"
3131
self.assertEqual(expected, result, message)
3232

3333
def _test_quality(self, args, expected):
3434
result = mimeparse.quality(args[0], args[1])
35-
message = "Expected: '%s' but got %s" % (expected, result)
35+
message = f"Expected: '{expected}' but got {result}"
3636
self.assertEqual(expected, result, message)
3737

3838
def _test_best_match(self, args, expected, description):
@@ -53,7 +53,7 @@ def _test_parse_mime_type(self, args, expected):
5353
else:
5454
expected = tuple(expected)
5555
result = mimeparse.parse_mime_type(args)
56-
message = "Expected: '%s' but got %s" % (expected, result)
56+
message = f"Expected: '{expected}' but got {result}"
5757
self.assertEqual(expected, result, message)
5858

5959
def test_parse_media_range(self):

setup.cfg

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ license_file = LICENSE
1414
classifiers =
1515
Programming Language :: Python
1616
Programming Language :: Python :: 3
17-
Programming Language :: Python :: 3.6
1817
Programming Language :: Python :: 3.7
1918
Programming Language :: Python :: 3.8
2019
Programming Language :: Python :: 3.9
2120
Programming Language :: Python :: 3.10
21+
Programming Language :: Python :: 3.11
22+
Programming Language :: Python :: 3.12
2223
Programming Language :: Python :: Implementation :: CPython
2324
Programming Language :: Python :: Implementation :: PyPy
2425
License :: OSI Approved :: MIT License
@@ -33,7 +34,7 @@ project_urls =
3334
Issue Tracker=https://github.com/falconry/python-mimeparse
3435

3536
[options]
36-
python_requires = >=3.5
37+
python_requires = >=3.7
3738
py_modules = mimeparse
3839
install_requires =
3940
tests_require =

0 commit comments

Comments
 (0)