Skip to content

Commit

Permalink
Formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
jesnie committed Mar 2, 2024
1 parent 39c6a86 commit 3edce4f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 41 deletions.
12 changes: 7 additions & 5 deletions compreq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,28 @@

set -xe

branch=compreq

git fetch origin main
git checkout main
git pull --rebase origin main
if ! git checkout -b compreq; then
git branch -D compreq
git checkout -b compreq
if ! git checkout -b ${branch}; then
git branch -D ${branch}
git checkout -b ${branch}
fi
poetry run python -m requirements
poetry run task format
if [[ $(git status --porcelain) ]]; then
poetry update
git \
-c "user.name=Update requirements bot" \
-c "user.email=none" \
commit \
-am "Update requirements."
git push origin +compreq
git push origin +${branch}
gh pr create \
--title "Update requirements" \
--body "Automatic update of requirements." \
--reviewer jesnie \
|| true
gh pr merge -s --auto
fi
53 changes: 25 additions & 28 deletions compreq/lazy.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,23 +333,23 @@ async def resolve(self, context: DistributionContext) -> Specifier:
"""Compute the `Specifier`."""

@overload
def __and__(self, rhs: AnySpecifierSet) -> LazySpecifierSet:
...
def __and__(self, rhs: AnySpecifierSet) -> LazySpecifierSet: ...

@overload
def __and__(self, rhs: OptionalRequirement | Requirement | LazyRequirement) -> LazyRequirement:
...
def __and__(
self, rhs: OptionalRequirement | Requirement | LazyRequirement
) -> LazyRequirement: ...

def __and__(self, rhs: AnyRequirement) -> LazySpecifierSet | LazyRequirement:
return compose(self, rhs)

@overload
def __rand__(self, lhs: AnySpecifierSet) -> LazySpecifierSet:
...
def __rand__(self, lhs: AnySpecifierSet) -> LazySpecifierSet: ...

@overload
def __rand__(self, lhs: OptionalRequirement | Requirement | LazyRequirement) -> LazyRequirement:
...
def __rand__(
self, lhs: OptionalRequirement | Requirement | LazyRequirement
) -> LazyRequirement: ...

def __rand__(self, lhs: AnyRequirement) -> LazySpecifierSet | LazyRequirement:
return compose(lhs, self)
Expand Down Expand Up @@ -412,23 +412,23 @@ async def resolve(self, context: DistributionContext) -> SpecifierSet:
"""Compute the `SpecifierSet`."""

@overload
def __and__(self, rhs: AnySpecifierSet) -> LazySpecifierSet:
...
def __and__(self, rhs: AnySpecifierSet) -> LazySpecifierSet: ...

@overload
def __and__(self, rhs: OptionalRequirement | Requirement | LazyRequirement) -> LazyRequirement:
...
def __and__(
self, rhs: OptionalRequirement | Requirement | LazyRequirement
) -> LazyRequirement: ...

def __and__(self, rhs: AnyRequirement) -> LazySpecifierSet | LazyRequirement:
return compose(self, rhs)

@overload
def __rand__(self, lhs: AnySpecifierSet) -> LazySpecifierSet:
...
def __rand__(self, lhs: AnySpecifierSet) -> LazySpecifierSet: ...

@overload
def __rand__(self, lhs: OptionalRequirement | Requirement | LazyRequirement) -> LazyRequirement:
...
def __rand__(
self, lhs: OptionalRequirement | Requirement | LazyRequirement
) -> LazyRequirement: ...

def __rand__(self, lhs: AnyRequirement) -> LazySpecifierSet | LazyRequirement:
return compose(lhs, self)
Expand Down Expand Up @@ -646,9 +646,9 @@ def get_lazy_requirement(requirement: AnyRequirement) -> LazyRequirement:
distribution=requirement.name,
url=requirement.url,
extras=frozenset(requirement.extras),
specifier=get_lazy_specifier_set(requirement.specifier)
if requirement.specifier
else None,
specifier=(
get_lazy_specifier_set(requirement.specifier) if requirement.specifier else None
),
marker=requirement.marker,
optional=requirement.optional,
)
Expand All @@ -657,9 +657,9 @@ def get_lazy_requirement(requirement: AnyRequirement) -> LazyRequirement:
distribution=requirement.name,
url=requirement.url,
extras=frozenset(requirement.extras),
specifier=get_lazy_specifier_set(requirement.specifier)
if requirement.specifier
else None,
specifier=(
get_lazy_specifier_set(requirement.specifier) if requirement.specifier else None
),
marker=requirement.marker,
optional=None,
)
Expand All @@ -672,24 +672,21 @@ def get_lazy_requirement(requirement: AnyRequirement) -> LazyRequirement:
def compose(
lhs: str | Specifier | LazySpecifier | SpecifierSet | LazySpecifierSet,
rhs: str | Specifier | LazySpecifier | SpecifierSet | LazySpecifierSet,
) -> LazySpecifierSet:
...
) -> LazySpecifierSet: ...


@overload
def compose(
lhs: AnyRequirement,
rhs: Release | LazyRelease | OptionalRequirement | Requirement | LazyRequirement,
) -> LazyRequirement:
...
) -> LazyRequirement: ...


@overload
def compose(
lhs: Release | LazyRelease | OptionalRequirement | Requirement | LazyRequirement,
rhs: AnyRequirement,
) -> LazyRequirement:
...
) -> LazyRequirement: ...


def compose(lhs: AnyRequirement, rhs: AnyRequirement) -> LazySpecifierSet | LazyRequirement:
Expand Down
1 change: 1 addition & 0 deletions compreq/pythonftp.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Code for crawling https://www.python.org/ftp/
"""

from __future__ import annotations

import datetime as dt
Expand Down
12 changes: 4 additions & 8 deletions compreq/roots.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ def __init__(
*,
default_python: Version | str | None = None,
context: Context,
) -> NoReturn:
...
) -> NoReturn: ...

@overload
def __init__(
Expand All @@ -47,8 +46,7 @@ def __init__(
*,
default_python: Version | str | None = None,
context: None = None,
) -> None:
...
) -> None: ...

@overload
def __init__(
Expand All @@ -57,8 +55,7 @@ def __init__(
*,
default_python: None = None,
context: Context,
) -> None:
...
) -> None: ...

@overload
def __init__(
Expand All @@ -67,8 +64,7 @@ def __init__(
*,
default_python: None = None,
context: None = None,
) -> NoReturn:
...
) -> NoReturn: ...

def __init__(
self,
Expand Down
1 change: 1 addition & 0 deletions compreq/scripts/get_distribution_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
This will be run as a stand-alone script, in a separate virtual environment.
"""

# Runs in a separate virtual environment, so Can ONLY depend on standard library:
import argparse
import json
Expand Down

0 comments on commit 3edce4f

Please sign in to comment.