Skip to content

Commit

Permalink
Bump pyupgrade to 3.9 plus and make fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Jan 29, 2024
1 parent 68d4f4e commit 7b0813c
Show file tree
Hide file tree
Showing 12 changed files with 24 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ repos:
rev: v3.15.0
hooks:
- id: pyupgrade
args: [--py38-plus]
args: [--py39-plus]
3 changes: 2 additions & 1 deletion src/jobflow_remote/cli/admin.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from typing import Annotated

import typer
from rich.prompt import Confirm
from rich.text import Text
from typing_extensions import Annotated

from jobflow_remote.cli.jf import app
from jobflow_remote.cli.jfr_typer import JFRTyper
Expand Down
3 changes: 1 addition & 2 deletions src/jobflow_remote/cli/execution.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Optional
from typing import Annotated, Optional

import typer
from typing_extensions import Annotated

from jobflow_remote.cli.jf import app
from jobflow_remote.cli.jfr_typer import JFRTyper
Expand Down
3 changes: 2 additions & 1 deletion src/jobflow_remote/cli/jf.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Annotated

import typer
from rich.text import Text
from typing_extensions import Annotated

from jobflow_remote.cli.jfr_typer import JFRTyper
from jobflow_remote.cli.utils import (
Expand Down
6 changes: 3 additions & 3 deletions src/jobflow_remote/cli/jfr_typer.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ class JFRTyper(typer.Typer):

def __init__(self, *args, **kwargs):
if "epilog" not in kwargs:
kwargs[
"epilog"
] = "Run [bold]'jf -h'[/] to display the [bold]global options[/]"
kwargs["epilog"] = (
"Run [bold]'jf -h'[/] to display the [bold]global options[/]"
)

if "rich_markup_mode" not in kwargs:
kwargs["rich_markup_mode"] = "rich"
Expand Down
3 changes: 1 addition & 2 deletions src/jobflow_remote/cli/job.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import io
from pathlib import Path
from typing import Optional
from typing import Annotated, Optional

import typer
from monty.json import jsanitize
from monty.serialization import dumpfn
from qtoolkit.core.data_objects import QResources
from rich.pretty import pprint
from typing_extensions import Annotated

from jobflow_remote import SETTINGS
from jobflow_remote.cli.formatting import format_job_info, get_job_info_table
Expand Down
3 changes: 2 additions & 1 deletion src/jobflow_remote/cli/project.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from typing import Annotated

import typer
from rich.prompt import Confirm
from rich.text import Text
from typing_extensions import Annotated

from jobflow_remote.cli.formatting import get_exec_config_table, get_worker_table
from jobflow_remote.cli.jf import app
Expand Down
2 changes: 1 addition & 1 deletion src/jobflow_remote/cli/runner.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import os
from typing import Annotated

import typer
from rich.table import Table
from rich.text import Text
from typing_extensions import Annotated

from jobflow_remote.cli.jf import app
from jobflow_remote.cli.jfr_typer import JFRTyper
Expand Down
11 changes: 5 additions & 6 deletions src/jobflow_remote/cli/types.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import json
from datetime import datetime
from typing import List, Optional
from typing import Annotated, Optional

import click
import typer
from typing_extensions import Annotated

from jobflow_remote.cli.utils import SerializeFileFormat, SortOption
from jobflow_remote.config.base import LogLevel
from jobflow_remote.jobs.state import FlowState, JobState

job_ids_indexes_opt = Annotated[
Optional[List[str]],
Optional[list[str]],
typer.Option(
"--job-id",
"-jid",
Expand All @@ -23,7 +22,7 @@


job_ids_opt = Annotated[
Optional[List[str]],
Optional[list[str]],
typer.Option(
"--job-id",
"-jid",
Expand All @@ -34,7 +33,7 @@


db_ids_opt = Annotated[
Optional[List[str]],
Optional[list[str]],
typer.Option(
"--db-id",
"-did",
Expand All @@ -44,7 +43,7 @@


flow_ids_opt = Annotated[
Optional[List[str]],
Optional[list[str]],
typer.Option(
"--flow-id",
"-fid",
Expand Down
6 changes: 3 additions & 3 deletions src/jobflow_remote/jobs/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,9 +737,9 @@ def check_run_status(self):
raise RemoteError(error, False)
set_output = {
"$set": {
"remote.queue_state": qstate.value
if qstate
else None,
"remote.queue_state": (
qstate.value if qstate else None
),
"state": next_state.value,
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/jobflow_remote/utils/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
import time
import warnings
from collections import defaultdict
from collections.abc import Iterable, Mapping
from datetime import datetime
from typing import TYPE_CHECKING, Any, Iterable, Mapping
from typing import TYPE_CHECKING, Any

from jobflow.utils import suuid
from pymongo import ReturnDocument
Expand Down
1 change: 1 addition & 0 deletions src/jobflow_remote/utils/schedule.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Scheduling tools based on the schedule module
"""

from __future__ import annotations

import logging
Expand Down

0 comments on commit 7b0813c

Please sign in to comment.