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

Bump mypy from 1.6.1 to 1.7.0 #4684

Merged
merged 4 commits into from
Nov 15, 2023
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
2 changes: 1 addition & 1 deletion contrib/mypy-stubs/configargparse/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from .configargparse import ArgParser as ArgParser
from .configargparse import YAMLConfigFileParser as YAMLConfigFileParser
from .configargparse import ArgumentParser as ArgumentParser
from .configargparse import YAMLConfigFileParser as YAMLConfigFileParser
18 changes: 7 additions & 11 deletions contrib/mypy-stubs/configargparse/configargparse.pyi
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
import argparse
from typing import Sequence, Any, TypeVar, OrderedDict
from typing import Any, OrderedDict, Sequence, TypeVar

__all__ = [
"ArgumentParser",
"YAMLConfigFileParser",
"ConfigFileParser"
]
__all__ = ["ArgumentParser", "YAMLConfigFileParser", "ConfigFileParser"]
_N = TypeVar("_N")

class ConfigFileParser(object):
Expand All @@ -16,17 +12,17 @@ class ConfigFileParser(object):
class YAMLConfigFileParser(ConfigFileParser):
def get_syntax_description(self) -> str: ...
def parse(self, stream: Any) -> OrderedDict[Any, Any]: ...
def serialize(self, items: OrderedDict[Any, Any], default_flow_style: bool = ...) -> Any: ...
def serialize(
self, items: OrderedDict[Any, Any], default_flow_style: bool = ...
) -> Any: ...

class ArgumentParser(argparse.ArgumentParser):
@property
def _config_file_parser(self) -> Any: ...

def __init__(self, *args: Any, **kwargs: Any) -> None: ...
# There may be a better way of type hinting this without a type: ignore, but mypy gets unhappy pretty much no matter what as the signatures for parse_args doesn't match with its superclass in argparse
def parse_args(self, args: Sequence[str] | None = None, namespace: Namespace | None = None, config_file_contents: str | None = None, env_vars: Any=None) -> Namespace: ... # type: ignore[override]

def parse_args(self, args: Sequence[str] | None = None, namespace: Namespace | None = None, config_file_contents: str | None = None, env_vars: Any = None) -> Namespace: ... # type: ignore[override]
def get_source_to_settings_dict(self) -> OrderedDict[Any, Any]: ...

Namespace = argparse.Namespace
ArgParser = ArgumentParser
ArgParser = ArgumentParser
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ astroid>=2.15,<3
sphinx-autodoc-typehints>=1.24.0,<2
sphinxcontrib-autoprogram==0.1.8
cwltest>=2.2.20211116163652
mypy==1.6.1
mypy==1.7.0
types-requests
types-setuptools
types-boto
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# import imp
import os
import types
from importlib.machinery import SourceFileLoader
import os
from tempfile import NamedTemporaryFile

from setuptools import find_packages, setup
Expand Down
1 change: 1 addition & 0 deletions src/toil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import time
from datetime import datetime
from typing import TYPE_CHECKING, Optional, Tuple

import requests
from pytz import timezone

Expand Down
8 changes: 3 additions & 5 deletions src/toil/batchSystems/abstractBatchSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@
import logging
import os
import shutil
import time
from abc import ABC, abstractmethod
from argparse import ArgumentParser, _ArgumentGroup
from contextlib import contextmanager
from threading import Condition
import time
from typing import (Any,
ContextManager,
Dict,
List,
Set,
Iterator,
List,
NamedTuple,
Optional,
Set,
Union,
cast)

Expand Down Expand Up @@ -135,7 +135,6 @@ def set_message_bus(self, message_bus: MessageBus) -> None:
bus, so that it can send informational messages about the jobs it is
running to other Toil components.
"""
pass

@abstractmethod
def issueBatchJob(self, jobDesc: JobDescription, job_environment: Optional[Dict[str, str]] = None) -> int:
Expand Down Expand Up @@ -264,7 +263,6 @@ def setOptions(cls, setOption: OptionSetter) -> None:
setOption(option_name, parsing_function=None, check_function=None, default=None, env=None)
returning nothing, used to update run configuration as a side effect.
"""
pass

def getWorkerContexts(self) -> List[ContextManager[Any]]:
"""
Expand Down
4 changes: 2 additions & 2 deletions src/toil/batchSystems/abstractGridEngineBatchSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
from datetime import datetime
from queue import Empty, Queue
from threading import Lock, Thread
from typing import Any, Dict, List, Optional, Tuple, Union
from typing import Dict, List, Optional, Tuple, Union

from toil.batchSystems.abstractBatchSystem import (BatchJobExitReason,
UpdatedBatchJobInfo)
from toil.batchSystems.cleanup_support import BatchSystemCleanupSupport
from toil.bus import ExternalBatchIdMessage
from toil.job import JobDescription, AcceleratorRequirement
from toil.job import AcceleratorRequirement
from toil.lib.misc import CalledProcessErrorStderr

logger = logging.getLogger(__name__)
Expand Down
16 changes: 8 additions & 8 deletions src/toil/batchSystems/awsBatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,25 @@
import time
import uuid
from argparse import ArgumentParser, _ArgumentGroup
from typing import Any, Callable, Dict, Iterator, List, Optional, Set, Union
from typing import Any, Dict, Iterator, List, Optional, Set, Union

from boto.exception import BotoServerError

from toil import applianceSelf
from toil.batchSystems.abstractBatchSystem import (EXIT_STATUS_UNAVAILABLE_VALUE,
BatchJobExitReason,
UpdatedBatchJobInfo,
InsufficientSystemResources)
from toil.batchSystems.options import OptionSetter
InsufficientSystemResources,
UpdatedBatchJobInfo)
from toil.batchSystems.cleanup_support import BatchSystemCleanupSupport
from toil.batchSystems.contained_executor import pack_job
from toil.bus import ExternalBatchIdMessage, MessageBus, MessageOutbox
from toil.batchSystems.options import OptionSetter
from toil.bus import ExternalBatchIdMessage
from toil.common import Config, Toil
from toil.job import JobDescription, Requirer
from toil.lib.aws import get_current_aws_region, zone_to_region
from toil.lib.aws import get_current_aws_region
from toil.lib.aws.session import establish_boto3_session
from toil.lib.conversions import b_to_mib, mib_to_b
from toil.lib.misc import slow_down, unix_now_ms, utc_now
from toil.lib.conversions import b_to_mib
from toil.lib.misc import slow_down, unix_now_ms
from toil.lib.retry import retry
from toil.resource import Resource

Expand Down
1 change: 0 additions & 1 deletion src/toil/batchSystems/htcondor.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

from toil.batchSystems.abstractGridEngineBatchSystem import \
AbstractGridEngineBatchSystem

from toil.job import AcceleratorRequirement
from toil.lib.retry import retry

Expand Down
8 changes: 4 additions & 4 deletions src/toil/batchSystems/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@
import logging
import math
import os
from queue import Empty, Queue
import string
import sys
import tempfile
from threading import Event, Thread, Condition, RLock
import time
import uuid
from argparse import ArgumentParser, _ArgumentGroup
from queue import Empty, Queue
from threading import Condition, Event, RLock, Thread
from typing import (Any,
Callable,
Dict,
Iterator,
List,
Set,
Literal,
Optional,
Set,
Tuple,
Type,
TypeVar,
Expand Down Expand Up @@ -104,7 +104,7 @@
from toil.batchSystems.cleanup_support import BatchSystemCleanupSupport
from toil.batchSystems.contained_executor import pack_job
from toil.batchSystems.options import OptionSetter
from toil.common import Config, Toil, SYS_MAX_SIZE
from toil.common import SYS_MAX_SIZE, Config, Toil
from toil.job import JobDescription, Requirer
from toil.lib.conversions import human2bytes
from toil.lib.misc import get_user_name, slow_down, utc_now
Expand Down
2 changes: 0 additions & 2 deletions src/toil/batchSystems/mesos/batchSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@
import pickle
import pwd
import socket
import sys
import time
import traceback
from argparse import ArgumentParser, _ArgumentGroup
from contextlib import contextmanager
from queue import Empty, Queue
from typing import Dict, Optional, Union
from urllib.parse import quote_plus
Expand Down
9 changes: 5 additions & 4 deletions src/toil/batchSystems/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
import logging
import sys
from argparse import ArgumentParser, _ArgumentGroup
from typing import Any, Callable, List, Optional, TypeVar, Union, cast
from typing import Any, Callable, List, Optional, TypeVar, Union

if sys.version_info >= (3, 8):
from typing import Protocol
else:
from typing_extensions import Protocol

from toil.batchSystems.registry import (get_batch_system,
get_batch_systems,
DEFAULT_BATCH_SYSTEM)
from toil.batchSystems.registry import (DEFAULT_BATCH_SYSTEM,
get_batch_system,
get_batch_systems)
from toil.lib.threading import cpu_count

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -81,6 +81,7 @@ def set_batchsystem_options(batch_system: Optional[str], set_option: OptionSette

def add_all_batchsystem_options(parser: Union[ArgumentParser, _ArgumentGroup]) -> None:
from toil.common import SYS_MAX_SIZE

# Do the global cross-batch-system arguments
parser.add_argument(
"--batchSystem",
Expand Down
2 changes: 1 addition & 1 deletion src/toil/batchSystems/parasol.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from queue import Empty, Queue
from shutil import which
from threading import Thread
from typing import Dict, Optional, Union, Type, Any
from typing import Dict, Optional, Union

from toil.batchSystems.abstractBatchSystem import (BatchSystemSupport,
UpdatedBatchJobInfo)
Expand Down
2 changes: 1 addition & 1 deletion src/toil/batchSystems/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# limitations under the License.

import importlib
import pkgutil
import logging
import pkgutil
import warnings
from typing import TYPE_CHECKING, Callable, Dict, List, Sequence, Tuple, Type

Expand Down
18 changes: 10 additions & 8 deletions src/toil/batchSystems/singleMachine.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,25 @@
from argparse import ArgumentParser, _ArgumentGroup
from queue import Empty, Queue
from threading import Event, Lock, Thread
from typing import Dict, List, Optional, Set, Sequence, Tuple, Union
from typing import Dict, List, Optional, Sequence, Set, Tuple, Union

import toil
from toil import worker as toil_worker
from toil.batchSystems.abstractBatchSystem import (EXIT_STATUS_UNAVAILABLE_VALUE,
BatchSystemSupport,
InsufficientSystemResources,
ResourcePool,
ResourceSet,
UpdatedBatchJobInfo,
InsufficientSystemResources)

from toil.bus import ExternalBatchIdMessage
UpdatedBatchJobInfo)
from toil.batchSystems.options import OptionSetter

from toil.bus import ExternalBatchIdMessage
from toil.common import SYS_MAX_SIZE, Config, Toil, make_open_interval_action
from toil.job import JobDescription, AcceleratorRequirement, accelerator_satisfies, Requirer
from toil.lib.accelerators import get_individual_local_accelerators, get_restrictive_environment_for_local_accelerators
from toil.job import (AcceleratorRequirement,
JobDescription,
Requirer,
accelerator_satisfies)
from toil.lib.accelerators import (get_individual_local_accelerators,
get_restrictive_environment_for_local_accelerators)
from toil.lib.threading import cpu_count

logger = logging.getLogger(__name__)
Expand Down
4 changes: 2 additions & 2 deletions src/toil/batchSystems/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
import os
from argparse import ArgumentParser, _ArgumentGroup
from shlex import quote
from typing import Callable, Dict, List, Optional, TypeVar, Union
from typing import Dict, List, Optional, TypeVar, Union

from toil.batchSystems.abstractGridEngineBatchSystem import \
AbstractGridEngineBatchSystem
from toil.batchSystems.options import OptionSetter
from toil.lib.misc import CalledProcessErrorStderr, call_command
from toil.job import Requirer
from toil.lib.misc import CalledProcessErrorStderr, call_command

logger = logging.getLogger(__name__)

Expand Down
1 change: 0 additions & 1 deletion src/toil/batchSystems/torque.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import os
import shlex
import tempfile
import time
from queue import Empty
from shlex import quote
from typing import Dict, List, Optional
Expand Down
7 changes: 2 additions & 5 deletions src/toil/bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,13 @@
"""

import collections
from dataclasses import dataclass
import inspect
import json
import logging

import os
import queue
import json
import tempfile
import threading
from dataclasses import dataclass
from typing import (IO,
Any,
Callable,
Expand All @@ -80,7 +78,6 @@
Optional,
Type,
TypeVar,
Union,
cast)

from pubsub.core import Publisher
Expand Down
Loading