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

chore: Run pyupgrade --py38-plus, remove mentions of lower python versions #47

Merged
merged 5 commits into from
Jan 2, 2024
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
7 changes: 5 additions & 2 deletions .github/workflows/run-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ jobs:
strategy:
matrix:
python-version:
- "3.5"
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "pypy-3.7"
- "pypy-3.8"
- "pypy-3.9"
- "pypy-3.10"

fail-fast: false

Expand Down
33 changes: 0 additions & 33 deletions .travis.yml

This file was deleted.

7 changes: 2 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
Python-MimeParse
================

.. image:: https://travis-ci.org/dbtsai/python-mimeparse.svg?branch=master
:target: https://travis-ci.org/dbtsai/python-mimeparse

This module provides basic functions for handling mime-types. It can
handle matching mime-types against a list of media-ranges. See section
5.3.2 of the HTTP 1.1 Semantics and Content specification [RFC 7231] for
Expand All @@ -18,7 +15,7 @@ Use **pip**:

$ pip install python-mimeparse

It supports Python 2.7, 3.4+ and PyPy.
It supports Python 3.7+ and PyPy.

Functions
---------
Expand Down Expand Up @@ -47,7 +44,7 @@ Choose the mime-type with the highest quality ("q") from a list of candidates.
Testing
-------

Run the tests by typing: ``python mimeparse_test.py``. The tests require Python 2.6.
Run the tests by typing: ``python mimeparse_test.py``.

To make sure that the package works in all the supported environments, you can
run **tox** tests:
Expand Down
2 changes: 1 addition & 1 deletion mimeparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def parse_mime_type(mime_type):
type_parts = full_type.split('/') if '/' in full_type else None
if not type_parts or len(type_parts) > 2:
raise MimeTypeParseException(
"Can't parse type \"{}\"".format(full_type))
f"Can't parse type \"{full_type}\"")

(type, subtype) = type_parts

Expand Down
8 changes: 4 additions & 4 deletions mimeparse_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
class MimeParseTestCase(unittest.TestCase):

def setUp(self):
super(MimeParseTestCase, self).setUp()
super().setUp()
with open("testdata.json") as f:
self.test_data = json.load(f)

def _test_parse_media_range(self, args, expected):
expected = tuple(expected)
result = mimeparse.parse_media_range(args)
message = "Expected: '%s' but got %s" % (expected, result)
message = f"Expected: '{expected}' but got {result}"
self.assertEqual(expected, result, message)

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

def _test_best_match(self, args, expected, description):
Expand All @@ -53,7 +53,7 @@ def _test_parse_mime_type(self, args, expected):
else:
expected = tuple(expected)
result = mimeparse.parse_mime_type(args)
message = "Expected: '%s' but got %s" % (expected, result)
message = f"Expected: '{expected}' but got {result}"
self.assertEqual(expected, result, message)

def test_parse_media_range(self):
Expand Down
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ license_file = LICENSE
classifiers =
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.12
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
License :: OSI Approved :: MIT License
Expand All @@ -33,7 +34,7 @@ project_urls =
Issue Tracker=https://github.com/falconry/python-mimeparse

[options]
python_requires = >=3.5
python_requires = >=3.7
py_modules = mimeparse
install_requires =
tests_require =
Expand Down