remove shebangs in inexecutable files, format with black and isort

This commit is contained in:
figsoda 2022-11-14 17:13:11 -05:00
parent e953da614a
commit 4fab744eac
22 changed files with 51 additions and 55 deletions

View File

@ -1,10 +1,12 @@
#!/usr/bin/env python
import sys
import os
sys.path.insert(0, os.path.join(
os.path.dirname(os.path.dirname(os.path.realpath(__file__)))))
import sys
sys.path.insert(
0, os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
)
from nix_update import main # NOQA
if __name__ == "__main__":
main()
main()

View File

@ -4,11 +4,11 @@ import sys
import tempfile
from typing import NoReturn, Optional
from .version.version import VersionPreference
from .eval import Package, eval_attr
from .options import Options
from .update import update
from .utils import run
from .version.version import VersionPreference
def die(msg: str) -> NoReturn:

View File

@ -1,11 +1,11 @@
import json
from dataclasses import dataclass, InitVar, field
from typing import List, Optional, Dict, Any
from dataclasses import InitVar, dataclass, field
from typing import Any, Dict, List, Optional
from .errors import UpdateError
from .options import Options
from .version.version import VersionPreference
from .utils import run
from .version.version import VersionPreference
@dataclass

View File

@ -1,8 +1,6 @@
#!/usr/bin/env python3
import re
import subprocess
from typing import Optional
import re
def old_version_from_diff(

View File

@ -1,5 +1,6 @@
from dataclasses import dataclass
from typing import Optional
from .version.version import VersionPreference

View File

@ -1,15 +1,15 @@
import fileinput
from typing import Optional, Dict
import subprocess
import tempfile
from typing import Dict, Optional
from .errors import UpdateError
from .eval import Package, eval_attr
from .git import old_version_from_git
from .options import Options
from .utils import info, run
from .version import fetch_latest_version
from .version.version import VersionPreference
from .git import old_version_from_git
def replace_version(package: Package) -> bool:

View File

@ -2,7 +2,7 @@ import os
import subprocess
import sys
from pathlib import Path
from typing import IO, Any, Callable, List, Optional, Union, Dict
from typing import IO, Any, Callable, Dict, List, Optional, Union
HAS_TTY = sys.stdout.isatty()
ROOT = Path(os.path.dirname(os.path.realpath(__file__)))

View File

@ -1,6 +1,6 @@
from urllib.parse import urlparse, ParseResult
from typing import List, Callable, Optional
import re
from typing import Callable, List, Optional
from urllib.parse import ParseResult, urlparse
from ..errors import VersionError
from .crate import fetch_crate_versions
@ -10,7 +10,7 @@ from .pypi import fetch_pypi_versions
from .rubygems import fetch_rubygem_versions
from .savannah import fetch_savannah_versions
from .sourcehut import fetch_sourcehut_versions
from .version import VersionPreference, Version
from .version import Version, VersionPreference
# def find_repology_release(attr) -> str:
# resp = urllib.request.urlopen(f"https://repology.org/api/v1/projects/{attr}/")

View File

@ -1,13 +1,13 @@
import re
import urllib.request
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element
from typing import List
from urllib.parse import ParseResult, urlparse
from xml.etree.ElementTree import Element
from .version import Version
from ..errors import VersionError
from ..utils import info
from .version import Version
def version_from_entry(entry: Element) -> Version:

View File

@ -4,9 +4,9 @@ import urllib.request
from typing import List
from urllib.parse import ParseResult
from .version import Version
from ..errors import VersionError
from ..utils import info
from .version import Version
GITLAB_API = re.compile(
r"http(s)?://(?P<domain>[^/]+)/api/v4/projects/(?P<project_id>[^/]*)/repository/archive.tar.gz\?sha=(?P<version>.+)"

View File

@ -3,8 +3,8 @@ import urllib.request
from typing import List
from urllib.parse import ParseResult
from .version import Version
from ..utils import info
from .version import Version
def fetch_pypi_versions(url: ParseResult) -> List[Version]:

View File

@ -1,12 +1,11 @@
import json
import urllib.request
from typing import List
from urllib.parse import ParseResult
import json
from .version import Version
from ..errors import VersionError
from ..utils import info
from .version import Version
def fetch_rubygem_versions(url: ParseResult) -> List[Version]:

View File

@ -1,13 +1,12 @@
import re
import urllib.request
import xml.etree.ElementTree as ET
from typing import List, Optional
from urllib.parse import ParseResult, urljoin, urlparse
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element
from .version import Version
from ..utils import info
from .version import Version
filename_regex = re.compile(r"-(\d+(?:\.\d+)*(?:-[^-.]+)?)\.tar\.[^.]+$")

View File

@ -1,12 +1,12 @@
import urllib.request
import xml.etree.ElementTree as ET
from xml.etree.ElementTree import Element
from typing import List
from urllib.parse import ParseResult, urlparse
from xml.etree.ElementTree import Element
from .version import Version
from ..errors import VersionError
from ..utils import info
from .version import Version
def version_from_entry(entry: Element) -> Version:

View File

@ -1,4 +1,3 @@
#!/usr/bin/env python3
from dataclasses import dataclass
from enum import Enum, auto
from typing import Optional

View File

@ -1,15 +1,13 @@
#!/usr/bin/env python3
import subprocess
import pytest
import sys
import os
from pathlib import Path
from typing import Type, Iterator
import shutil
import subprocess
import sys
import tempfile
from contextlib import contextmanager
from pathlib import Path
from typing import Iterator, Type
import pytest
TEST_ROOT = Path(__file__).parent.resolve()
sys.path.append(str(TEST_ROOT.parent))

View File

@ -1,9 +1,9 @@
#!/usr/bin/env python3
import subprocess
import conftest
from nix_update.options import Options
from nix_update.update import update
import subprocess
import conftest
def test_update(helpers: conftest.Helpers) -> None:

View File

@ -1,9 +1,9 @@
#!/usr/bin/env python3
from pathlib import Path
from nix_update.git import old_version_from_diff
import conftest
from nix_update.git import old_version_from_diff
TEST_ROOT = Path(__file__).parent.resolve()

View File

@ -1,9 +1,9 @@
#!/usr/bin/env python3
import subprocess
import conftest
from nix_update.options import Options
from nix_update.update import update
import subprocess
import conftest
def test_update(helpers: conftest.Helpers) -> None:

View File

@ -1,8 +1,8 @@
#!/usr/bin/env python3
import subprocess
import conftest
from nix_update import main
import subprocess
import conftest
def test_main(helpers: conftest.Helpers) -> None:

View File

@ -1,9 +1,9 @@
#!/usr/bin/env python3
import subprocess
import conftest
from nix_update.options import Options
from nix_update.update import update
import subprocess
import conftest
def test_update(helpers: conftest.Helpers) -> None:

View File

@ -1,9 +1,9 @@
#!/usr/bin/env python3
import subprocess
import conftest
from nix_update.options import Options
from nix_update.update import update
import subprocess
import conftest
def test_update(helpers: conftest.Helpers) -> None: