Skip to content

Commit

Permalink
Bump minimum Python version to 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
koba-e964 committed May 3, 2024
1 parent c9f92ac commit 0fdcda9
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 19 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,15 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.6, 3.7, 3.8]
include:
- os: ubuntu-20.04
python-version: 3.6
exclude:
- os: ubuntu-latest
python-version: 3.6
python-version:
- '3.8'
- '3.10'
- '3.12'

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
Expand Down
4 changes: 2 additions & 2 deletions onlinejudge_command/subcommand/generate_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def submit(f, *args, **kwargs):

def write_result(input_data: bytes, output_data: Optional[bytes], *, input_path: pathlib.Path, output_path: pathlib.Path, print_data: bool, lock: Optional[threading.Lock] = None) -> None:
# acquire lock to print logs properly, if in parallel
nullcontext = contextlib.ExitStack() # TODO: use contextlib.nullcontext after Python 3.7
nullcontext = contextlib.nullcontext()
with lock or nullcontext:

if not input_path.parent.is_dir():
Expand Down Expand Up @@ -125,7 +125,7 @@ def check_randomness_of_generator(input_data: bytes, *, name: str, lock: Optiona
return None

input_digest = hashlib.sha1(input_data).digest()
nullcontext = contextlib.ExitStack() # TODO: use contextlib.nullcontext after Python 3.7
nullcontext = contextlib.nullcontext()
with lock or nullcontext:
if len(generated_input_hashes) < limit:
if input_digest in generated_input_hashes:
Expand Down
4 changes: 2 additions & 2 deletions onlinejudge_command/subcommand/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,8 @@ def test_single_case(test_name: str, test_input_path: pathlib.Path, test_output_
elapsed: float = info['elapsed']
memory: Optional[float] = info['memory']

# lock is require to avoid mixing logs if in parallel
nullcontext = contextlib.ExitStack() # TODO: use contextlib.nullcontext() after updating Python to 3.7
# lock is required to avoid mixing logs if in parallel
nullcontext = contextlib.nullcontext()
with lock or nullcontext:
if lock is not None:
logger.info('')
Expand Down
5 changes: 1 addition & 4 deletions onlinejudge_command/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,7 @@ def webbrowser_register_explorer_exe() -> None:
if not is_windows_subsystem_for_linux():
return
instance = webbrowser.GenericBrowser('explorer.exe')
if sys.version_info < (3, 7):
webbrowser.register('explorer', None, instance) # TODO: remove this after Python 3.6 supprot is finished
else:
webbrowser.register('explorer', None, instance, preferred=True) # `preferred=True` solves the issue that terminal logs are cleared on cmd.exe with stopping using wslview via www-browser. TODO: remove `preferred=True` after https://github.com/wslutilities/wslu/issues/199 is fixed.
webbrowser.register('explorer', None, instance, preferred=True) # `preferred=True` solves the issue that terminal logs are cleared on cmd.exe with stopping using wslview via www-browser. TODO: remove `preferred=True` after https://github.com/wslutilities/wslu/issues/199 is fixed.


def get_default_command() -> str:
Expand Down
5 changes: 3 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ classifiers =
Intended Audience :: Developers
License :: OSI Approved :: MIT License
Operating System :: OS Independent
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.12
Topic :: Internet :: WWW/HTTP
Topic :: Software Development
Topic :: Text Processing :: Markup :: HTML
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
url=version.__url__,
license=version.__license__,
description=version.__description__,
python_requires='>=3.6',
python_requires='>=3.8',
install_requires=[
'online-judge-api-client >= 10.9.0, < 11',
'colorama >= 0.3, < 1',
Expand Down

0 comments on commit 0fdcda9

Please sign in to comment.