Skip to content

Commit

Permalink
Merge branch 'master' into fix/duplicates-on-add
Browse files Browse the repository at this point in the history
  • Loading branch information
Secrus authored Oct 27, 2022
2 parents 91b7335 + 4a07b5e commit 9b45b93
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ ban-relative-imports = true
format-greedy = 1
inline-quotes = double
enable-extensions = TC, TC1
type-checking-exempt-modules = typing, typing-extensions
type-checking-strict = true
eradicate-whitelist-extend = ^-.*;
extend-ignore =
# E203: Whitespace before ':' (pycqa/pycodestyle#373)
Expand Down
7 changes: 1 addition & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
strategy:
matrix:
os: [Ubuntu, macOS, Windows]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11-dev"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
include:
- os: Ubuntu
image: ubuntu-22.04
Expand Down Expand Up @@ -83,11 +83,6 @@ jobs:
# Using `timeout` is a safeguard against the Poetry command hanging for some reason.
timeout 10s poetry run pip --version || rm -rf .venv
# XXX: https://github.com/pypa/pip/issues/11352 causes random failures -- remove once fixed in a release.
- name: Upgrade pip on Python 3.11
if: ${{ matrix.python-version == '3.11-dev' }}
run: poetry run pip install git+https://github.com/pypa/pip.git@f8a25921e5c443b07483017b0ffdeb08b9ba2fdf

- name: Install dependencies
run: poetry install --with github-actions

Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ repos:
- flake8-quotes==3.3.1
- flake8-simplify==0.19.3
- flake8-tidy-imports==4.8.0
- flake8-type-checking==2.1.2
- flake8-type-checking==2.2.0
- flake8-typing-imports==1.12.0
- flake8-use-fstring==1.4
- pep8-naming==0.13.1
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2018 Sébastien Eustace
Copyright (c) 2018-present Sébastien Eustace

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
4 changes: 2 additions & 2 deletions docs/dependency-specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ for extras in your project refer to [`extras`]({{< relref "pyproject#extras" >}}

## `source` dependencies

To depend on a package from an [alternate repository]({{< relref "repositories/#install-dependencies-from-a-private-repository" >}}),
To depend on a package from an [alternate repository]({{< relref "repositories#installing-from-private-package-sources" >}}),
you can use the `source` property:

```toml
Expand All @@ -267,7 +267,7 @@ poetry add my-cool-package --source foo
```

{{% note %}}
In this example, we expect `foo` to be configured correctly. See [using a private repository](repositories.md#using-a-private-repository)
In this example, we expect `foo` to be configured correctly. See [using a private repository]({{< relref "repositories#installing-from-private-package-sources" >}})
for further information.
{{% /note %}}

Expand Down
3 changes: 2 additions & 1 deletion src/poetry/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,8 @@ def create_pyproject_from_package(
constraint["optional"] = True

if len(constraint) == 1 and "version" in constraint:
constraint = cast(str, constraint["version"])
assert isinstance(constraint["version"], str)
constraint = constraint["version"]
elif not constraint:
constraint = "*"

Expand Down
4 changes: 2 additions & 2 deletions src/poetry/installation/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from subprocess import CalledProcessError
from typing import TYPE_CHECKING
from typing import Any
from typing import cast

from cleo.io.null_io import NullIO
from poetry.core.packages.file_dependency import FileDependency
Expand Down Expand Up @@ -771,7 +770,8 @@ def _save_url_reference(self, operation: Operation) -> None:
for dist in self._env.site_packages.distributions(
name=package.name, writable_only=True
):
dist_path = cast(Path, dist._path) # type: ignore[attr-defined]
dist_path = dist._path # type: ignore[attr-defined]
assert isinstance(dist_path, Path)
url = dist_path / "direct_url.json"
url.write_text(json.dumps(url_reference), encoding="utf-8")

Expand Down
10 changes: 6 additions & 4 deletions src/poetry/mixology/failure.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

from typing import TYPE_CHECKING
from typing import cast

from poetry.core.constraints.version import parse_constraint

Expand Down Expand Up @@ -114,7 +113,8 @@ def _visit(
conjunction = "So," if conclusion or incompatibility == self._root else "And"
incompatibility_string = str(incompatibility)

cause: ConflictCause = cast(ConflictCause, incompatibility.cause)
cause = incompatibility.cause
assert isinstance(cause, ConflictCause)

if isinstance(cause.conflict.cause, ConflictCause) and isinstance(
cause.other.cause, ConflictCause
Expand Down Expand Up @@ -198,7 +198,8 @@ def _visit(
numbered=numbered,
)
elif self._is_collapsible(derived):
derived_cause: ConflictCause = cast(ConflictCause, derived.cause)
derived_cause = derived.cause
assert isinstance(derived_cause, ConflictCause)
if isinstance(derived_cause.conflict.cause, ConflictCause):
collapsed_derived = derived_cause.conflict
collapsed_ext = derived_cause.other
Expand Down Expand Up @@ -233,7 +234,8 @@ def _is_collapsible(self, incompatibility: Incompatibility) -> bool:
if self._derivations[incompatibility] > 1:
return False

cause: ConflictCause = cast(ConflictCause, incompatibility.cause)
cause = incompatibility.cause
assert isinstance(cause, ConflictCause)
if isinstance(cause.conflict.cause, ConflictCause) and isinstance(
cause.other.cause, ConflictCause
):
Expand Down
6 changes: 0 additions & 6 deletions src/poetry/utils/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,12 +451,6 @@ def find(
if value[-1] is True
]

def __getattr__(self, item: str) -> Any:
try:
return super().__getattribute__(item)
except AttributeError:
return getattr(self.path, item)


class EnvError(Exception):
pass
Expand Down
4 changes: 2 additions & 2 deletions src/poetry/utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from typing import Any
from typing import Iterator
from typing import Mapping
from typing import cast

from poetry.utils.constants import REQUESTS_TIMEOUT

Expand Down Expand Up @@ -189,7 +188,8 @@ def _get_win_folder_from_registry(csidl_name: str) -> str:
)
dir, type = _winreg.QueryValueEx(key, shell_folder_name)

return cast(str, dir)
assert isinstance(dir, str)
return dir


def _get_win_folder_with_ctypes(csidl_name: str) -> str:
Expand Down

0 comments on commit 9b45b93

Please sign in to comment.