Skip to content

Commit

Permalink
style: pre-commit run -a
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Jan 6, 2021
1 parent 538c068 commit 749201a
Show file tree
Hide file tree
Showing 39 changed files with 99 additions and 90 deletions.
12 changes: 7 additions & 5 deletions bin/bump_version.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#!/usr/bin/env python3

import click
from pathlib import Path
import glob
import os
import cibuildwheel
from packaging.version import Version, InvalidVersion
import subprocess
import glob
import urllib.parse
from pathlib import Path

import click
from packaging.version import InvalidVersion, Version

import cibuildwheel

config = [
# file path, version find/replace format
Expand Down
2 changes: 1 addition & 1 deletion bin/make_dependency_update_pr.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/usr/bin/env python3

import os
import textwrap
import time
from pathlib import Path
from subprocess import run

import click
import textwrap


def shell(cmd, **kwargs):
Expand Down
9 changes: 4 additions & 5 deletions bin/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@

import builtins
import functools
import urllib.request
import xml.dom.minidom
from datetime import datetime
from io import StringIO
from typing import Dict, Any, List, Optional, TextIO
from pathlib import Path
from typing import Any, Dict, List, Optional, TextIO

import click
import yaml
from github import Github
import urllib.request
import xml.dom.minidom
from pathlib import Path


ICONS = (
"appveyor",
Expand Down
9 changes: 5 additions & 4 deletions bin/run_example_ci_configs.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
#!/usr/bin/env python3

import os
from pathlib import Path
import shutil
from subprocess import run
import sys
import textwrap
import time
import click
from glob import glob
from collections import namedtuple
from glob import glob
from pathlib import Path
from subprocess import run
from urllib.parse import quote

import click


def shell(cmd, **kwargs):
return run([cmd], shell=True, **kwargs)
Expand Down
2 changes: 1 addition & 1 deletion bin/sample_build.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env python3

import argparse
import os
import subprocess
import sys
import argparse
import tempfile
from pathlib import Path

Expand Down
6 changes: 1 addition & 5 deletions cibuildwheel/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,13 @@
import traceback
from configparser import ConfigParser
from pathlib import Path

from typing import Any, Dict, List, Optional, Set, overload

import cibuildwheel
import cibuildwheel.linux
import cibuildwheel.macos
import cibuildwheel.windows
from cibuildwheel.environment import (
EnvironmentParseError,
parse_environment,
)
from cibuildwheel.environment import EnvironmentParseError, parse_environment
from cibuildwheel.util import (
Architecture,
BuildOptions,
Expand Down
2 changes: 1 addition & 1 deletion cibuildwheel/docker_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import sys
import uuid
from pathlib import Path, PurePath
from typing import cast, IO, Dict, List, Optional, Sequence, Type
from types import TracebackType
from typing import IO, Dict, List, Optional, Sequence, Type, cast

from .typing import PathOrStr, PopenBytes

Expand Down
4 changes: 2 additions & 2 deletions cibuildwheel/environment.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import bashlex

from typing import Dict, List, Mapping, Optional

import bashlex

from . import bashlex_eval


Expand Down
11 changes: 8 additions & 3 deletions cibuildwheel/linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@

from .docker_container import DockerContainer
from .logger import log
from .typing import PathOrStr
from .util import (
Architecture, BuildOptions, BuildSelector, NonPlatformWheelError,
allowed_architectures_check, get_build_verbosity_extra_flags, prepare_command,
Architecture,
BuildOptions,
BuildSelector,
NonPlatformWheelError,
allowed_architectures_check,
get_build_verbosity_extra_flags,
prepare_command,
)
from .typing import PathOrStr


class PythonConfiguration(NamedTuple):
Expand Down
2 changes: 1 addition & 1 deletion cibuildwheel/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import re
import sys
import time
from typing import Optional, Union, AnyStr, IO
from typing import IO, AnyStr, Optional, Union

from cibuildwheel.util import CIProvider, detect_ci_provider

Expand Down
14 changes: 11 additions & 3 deletions cibuildwheel/macos.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,18 @@

from .environment import ParsedEnvironment
from .logger import log
from .util import (BuildOptions, BuildSelector, NonPlatformWheelError,
download, get_build_verbosity_extra_flags, get_pip_script,
install_certifi_script, prepare_command, allowed_architectures_check)
from .typing import PathOrStr
from .util import (
BuildOptions,
BuildSelector,
NonPlatformWheelError,
allowed_architectures_check,
download,
get_build_verbosity_extra_flags,
get_pip_script,
install_certifi_script,
prepare_command,
)


def call(args: Sequence[PathOrStr], env: Optional[Dict[str, str]] = None, cwd: Optional[str] = None, shell: bool = False) -> int:
Expand Down
2 changes: 1 addition & 1 deletion cibuildwheel/resources/get-pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import os.path
import pkgutil
import shutil
import sys
import struct
import sys
import tempfile

# Useful for very coarse version differentiation.
Expand Down
1 change: 1 addition & 0 deletions cibuildwheel/resources/install_certifi.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def main():
"-E", "-s", "-m", "pip", "install", "--upgrade", "certifi"])

import certifi

# change working directory to the default SSL directory
os.chdir(openssl_dir)
relpath_to_certifi_cafile = os.path.relpath(certifi.where())
Expand Down
3 changes: 1 addition & 2 deletions cibuildwheel/typing.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import Union, TYPE_CHECKING
import os
import subprocess

from typing import TYPE_CHECKING, Union

if TYPE_CHECKING:
PopenBytes = subprocess.Popen[bytes]
Expand Down
2 changes: 1 addition & 1 deletion cibuildwheel/util.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import functools
import os
import platform as platform_module
import re
import ssl
import sys
import functools
import textwrap
import urllib.request
from enum import Enum
Expand Down
14 changes: 11 additions & 3 deletions cibuildwheel/windows.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,18 @@

from .environment import ParsedEnvironment
from .logger import log
from .util import (Architecture, BuildOptions, BuildSelector, NonPlatformWheelError,
download, get_build_verbosity_extra_flags, get_pip_script,
prepare_command, allowed_architectures_check)
from .typing import PathOrStr
from .util import (
Architecture,
BuildOptions,
BuildSelector,
NonPlatformWheelError,
allowed_architectures_check,
download,
get_build_verbosity_extra_flags,
get_pip_script,
prepare_command,
)

IS_RUNNING_ON_AZURE = Path('C:\\hostedtoolcache').exists()
IS_RUNNING_ON_TRAVIS = os.environ.get('TRAVIS_OS_NAME') == 'windows'
Expand Down
2 changes: 2 additions & 0 deletions test/test_0_basic.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import platform
import textwrap

import pytest

from cibuildwheel.logger import Logger

from . import test_projects, utils

basic_project = test_projects.new_c_project(
Expand Down
6 changes: 3 additions & 3 deletions test/test_before_all.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pytest
import subprocess
import textwrap

from . import utils
from . import test_projects
import pytest

from . import test_projects, utils

project_with_before_build_asserts = test_projects.new_c_project(
setup_py_add=textwrap.dedent(r'''
Expand Down
6 changes: 3 additions & 3 deletions test/test_before_build.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import pytest
import subprocess
import textwrap

from . import utils
from . import test_projects
import pytest

from . import test_projects, utils

project_with_before_build_asserts = test_projects.new_c_project(
setup_py_add=textwrap.dedent(r'''
Expand Down
3 changes: 1 addition & 2 deletions test/test_before_test.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from . import test_projects
from . import utils
from . import test_projects, utils

before_test_project = test_projects.new_c_project()
before_test_project.files['test/spam_test.py'] = r'''
Expand Down
3 changes: 1 addition & 2 deletions test/test_build_skip.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import textwrap

from . import utils
from . import test_projects
from . import test_projects, utils

project_with_skip_asserts = test_projects.new_c_project(
setup_py_add=textwrap.dedent(r'''
Expand Down
8 changes: 4 additions & 4 deletions test/test_dependency_versions.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import re
import pytest
import textwrap
import cibuildwheel.util

from . import utils
from . import test_projects
import pytest

import cibuildwheel.util

from . import test_projects, utils

project_with_expected_version_checks = test_projects.new_c_project(
setup_py_add=textwrap.dedent(r'''
Expand Down
3 changes: 1 addition & 2 deletions test/test_docker_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

import pytest

from . import utils
from . import test_projects
from . import test_projects, utils

dockcross_only_project = test_projects.new_c_project(
setup_py_add=textwrap.dedent(r'''
Expand Down
4 changes: 2 additions & 2 deletions test/test_emulation.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import subprocess

import pytest
from . import utils
from . import test_projects

from . import test_projects, utils

project_with_a_test = test_projects.new_c_project()

Expand Down
6 changes: 3 additions & 3 deletions test/test_environment.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import os
import pytest
import subprocess
import textwrap
from . import utils
from . import test_projects

import pytest

from . import test_projects, utils

project_with_environment_asserts = test_projects.new_c_project(
setup_py_add=textwrap.dedent(r'''
Expand Down
3 changes: 1 addition & 2 deletions test/test_manylinuxXXXX_only.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

import pytest

from . import utils
from . import test_projects
from . import test_projects, utils

# TODO: specify these at runtime according to manylinux_image
project_with_manylinux_symbols = test_projects.new_c_project(
Expand Down
6 changes: 3 additions & 3 deletions test/test_pep518.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import textwrap
from . import test_projects
from . import utils
import os
import textwrap

from . import test_projects, utils

basic_project = test_projects.new_c_project(
setup_py_add=textwrap.dedent(
Expand Down
4 changes: 1 addition & 3 deletions test/test_projects/base.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from pathlib import Path
from typing import Any, Dict, Union

import jinja2

from typing import Union, Dict, Any


FilesDict = Dict[str, Union[str, jinja2.Template]]
TemplateContext = Dict[str, Any]

Expand Down
2 changes: 1 addition & 1 deletion test/test_projects/c.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import jinja2
from .base import TestProject

from .base import TestProject

SPAM_C_TEMPLATE = r'''
#include <Python.h>
Expand Down
4 changes: 3 additions & 1 deletion test/test_pure_wheel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import subprocess
import pytest
from test import test_projects

import pytest

from . import utils

pure_python_project = test_projects.TestProject()
Expand Down
Loading

0 comments on commit 749201a

Please sign in to comment.