collections.namedtuple to typing.NameTuple and flake8 fixes
This commit is contained in:
@@ -5,7 +5,7 @@ import textwrap
|
|||||||
import traceback
|
import traceback
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
|
|
||||||
from typing import Any, Dict, List, Optional, Union, overload
|
from typing import Any, Dict, List, Optional, overload
|
||||||
|
|
||||||
import cibuildwheel
|
import cibuildwheel
|
||||||
import cibuildwheel.linux
|
import cibuildwheel.linux
|
||||||
@@ -24,12 +24,10 @@ from cibuildwheel.util import (
|
|||||||
|
|
||||||
|
|
||||||
@overload
|
@overload
|
||||||
def get_option_from_environment(option_name: str, platform: Optional[str], default: str) -> str:
|
def get_option_from_environment(option_name: str, platform: Optional[str], default: str) -> str: ... # noqa: E704
|
||||||
...
|
|
||||||
@overload
|
@overload
|
||||||
def get_option_from_environment(option_name: str, platform: Optional[str] = None, default: None = None) -> Optional[str]:
|
def get_option_from_environment(option_name: str, platform: Optional[str] = None, default: None = None) -> Optional[str]: ... # noqa: E704 E302
|
||||||
...
|
def get_option_from_environment(option_name: str, platform: Optional[str] = None, default: Optional[str] = None) -> Optional[str]: # noqa: E302
|
||||||
def get_option_from_environment(option_name: str, platform: Optional[str] = None, default: Optional[str] = None) -> Optional[str]:
|
|
||||||
'''
|
'''
|
||||||
Returns an option from the environment, optionally scoped by the platform.
|
Returns an option from the environment, optionally scoped by the platform.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import shlex
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
from collections import namedtuple
|
|
||||||
|
|
||||||
from typing import Dict, List, NamedTuple, Optional
|
from typing import Dict, List, NamedTuple, Optional
|
||||||
|
|
||||||
|
|||||||
@@ -5,13 +5,9 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
import uuid
|
import uuid
|
||||||
from collections import namedtuple
|
|
||||||
|
|
||||||
from typing import Callable, Dict, List, Optional
|
from typing import Callable, List, NamedTuple
|
||||||
|
|
||||||
from .environment import (
|
|
||||||
ParsedEnvironment,
|
|
||||||
)
|
|
||||||
from .util import (
|
from .util import (
|
||||||
BuildOptions,
|
BuildOptions,
|
||||||
get_build_verbosity_extra_flags,
|
get_build_verbosity_extra_flags,
|
||||||
@@ -47,7 +43,7 @@ def matches_platform(identifier):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
PythonConfiguration = namedtuple('PythonConfiguration', ['version', 'identifier', 'path'])
|
PythonConfiguration = NamedTuple('PythonConfiguration', [('version', str), ('identifier', str), ('path', str)])
|
||||||
|
|
||||||
|
|
||||||
def get_python_configurations(build_selector: Callable[[str], bool]) -> List[PythonConfiguration]:
|
def get_python_configurations(build_selector: Callable[[str], bool]) -> List[PythonConfiguration]:
|
||||||
|
|||||||
@@ -4,14 +4,10 @@ import shutil
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
from collections import namedtuple
|
|
||||||
from glob import glob
|
from glob import glob
|
||||||
|
|
||||||
from typing import Callable, Dict, List, Optional, Union
|
from typing import Callable, Dict, List, Optional, NamedTuple, Union
|
||||||
|
|
||||||
from .environment import (
|
|
||||||
ParsedEnvironment,
|
|
||||||
)
|
|
||||||
from .util import (
|
from .util import (
|
||||||
BuildOptions,
|
BuildOptions,
|
||||||
download,
|
download,
|
||||||
@@ -31,7 +27,7 @@ def call(args: Union[str, List[str]], env: Optional[Dict[str, str]] = None, cwd:
|
|||||||
return subprocess.check_call(args, env=env, cwd=cwd, shell=shell)
|
return subprocess.check_call(args, env=env, cwd=cwd, shell=shell)
|
||||||
|
|
||||||
|
|
||||||
PythonConfiguration = namedtuple('PythonConfiguration', ['version', 'identifier', 'url'])
|
PythonConfiguration = NamedTuple('PythonConfiguration', [('version', str), ('identifier', str), ('url', str)])
|
||||||
|
|
||||||
|
|
||||||
def get_python_configurations(build_selector: Callable[[str], bool]) -> List[PythonConfiguration]:
|
def get_python_configurations(build_selector: Callable[[str], bool]) -> List[PythonConfiguration]:
|
||||||
|
|||||||
@@ -3,15 +3,11 @@ import shutil
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
from collections import namedtuple
|
|
||||||
from glob import glob
|
from glob import glob
|
||||||
from zipfile import ZipFile
|
from zipfile import ZipFile
|
||||||
|
|
||||||
from typing import Callable, Dict, List, Optional
|
from typing import Callable, Dict, List, Optional, NamedTuple
|
||||||
|
|
||||||
from .environment import (
|
|
||||||
ParsedEnvironment,
|
|
||||||
)
|
|
||||||
from .util import (
|
from .util import (
|
||||||
BuildOptions,
|
BuildOptions,
|
||||||
download,
|
download,
|
||||||
@@ -37,7 +33,7 @@ def get_nuget_args(version: str, arch: str) -> List[str]:
|
|||||||
return [python_name, '-Version', version, '-OutputDirectory', 'C:\\cibw\\python']
|
return [python_name, '-Version', version, '-OutputDirectory', 'C:\\cibw\\python']
|
||||||
|
|
||||||
|
|
||||||
PythonConfiguration = namedtuple('PythonConfiguration', ['version', 'arch', 'identifier', 'url'])
|
PythonConfiguration = NamedTuple('PythonConfiguration', [('version', str), ('arch', str), ('identifier', str), ('url', Optional[str])])
|
||||||
|
|
||||||
|
|
||||||
def get_python_configurations(build_selector: Callable[[str], bool]) -> List[PythonConfiguration]:
|
def get_python_configurations(build_selector: Callable[[str], bool]) -> List[PythonConfiguration]:
|
||||||
@@ -81,8 +77,9 @@ def install_cpython(version: str, arch: str, nuget: str) -> str:
|
|||||||
return installation_path
|
return installation_path
|
||||||
|
|
||||||
|
|
||||||
def install_pypy(version: str, arch: str, url: str) -> str:
|
def install_pypy(version: str, arch: str, url: Optional[str]) -> str:
|
||||||
assert arch == '32'
|
assert arch == '32'
|
||||||
|
assert url is not None
|
||||||
# Inside the PyPy zip file is a directory with the same name
|
# Inside the PyPy zip file is a directory with the same name
|
||||||
zip_filename = url.rsplit('/', 1)[-1]
|
zip_filename = url.rsplit('/', 1)[-1]
|
||||||
installation_path = os.path.join('C:\\cibw', os.path.splitext(zip_filename)[0])
|
installation_path = os.path.join('C:\\cibw', os.path.splitext(zip_filename)[0])
|
||||||
|
|||||||
Reference in New Issue
Block a user