提交 90c4ce82 authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Use Sequence from the typing package

上级 c27183cf
...@@ -2,7 +2,6 @@ import logging ...@@ -2,7 +2,6 @@ import logging
import os import os
import shlex import shlex
import sys import sys
import typing
import warnings import warnings
from configparser import ( from configparser import (
ConfigParser, ConfigParser,
...@@ -13,7 +12,7 @@ from configparser import ( ...@@ -13,7 +12,7 @@ from configparser import (
) )
from functools import wraps from functools import wraps
from io import StringIO from io import StringIO
from typing import Optional from typing import Callable, Dict, Optional, Sequence, Union
from aesara.utils import deprecated, hash_from_code from aesara.utils import deprecated, hash_from_code
...@@ -94,7 +93,7 @@ class AesaraConfigParser: ...@@ -94,7 +93,7 @@ class AesaraConfigParser:
self._flags_dict = flags_dict self._flags_dict = flags_dict
self._aesara_cfg = aesara_cfg self._aesara_cfg = aesara_cfg
self._aesara_raw_cfg = aesara_raw_cfg self._aesara_raw_cfg = aesara_raw_cfg
self._config_var_dict: typing.Dict = {} self._config_var_dict: Dict = {}
super().__init__() super().__init__()
def __str__(self, print_doc=True): def __str__(self, print_doc=True):
...@@ -268,10 +267,10 @@ class ConfigParam: ...@@ -268,10 +267,10 @@ class ConfigParam:
def __init__( def __init__(
self, self,
default: typing.Union[object, typing.Callable[[object], object]], default: Union[object, Callable[[object], object]],
*, *,
apply: typing.Optional[typing.Callable[[object], object]] = None, apply: Optional[Callable[[object], object]] = None,
validate: typing.Optional[typing.Callable[[object], bool]] = None, validate: Optional[Callable[[object], bool]] = None,
mutable: bool = True, mutable: bool = True,
): ):
""" """
...@@ -373,7 +372,7 @@ class ConfigParam: ...@@ -373,7 +372,7 @@ class ConfigParam:
class EnumStr(ConfigParam): class EnumStr(ConfigParam):
def __init__( def __init__(
self, default: str, options: typing.Sequence[str], validate=None, mutable=True self, default: str, options: Sequence[str], validate=None, mutable=True
): ):
"""Creates a str-based parameter that takes a predefined set of options. """Creates a str-based parameter that takes a predefined set of options.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论