Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
cb1c9fa0
Commit
cb1c9fa0
authored
May 07, 2022
by
Arun Babu Neelicattu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
typing: fix mypy inspection issues
parent
7ab4cf3a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
41 additions
and
26 deletions
+41
-26
src/poetry/console/commands/plugin/show.py
+3
-1
src/poetry/console/commands/self/self_command.py
+2
-2
src/poetry/console/commands/self/show/__init__.py
+2
-1
src/poetry/console/commands/self/show/plugins.py
+32
-21
src/poetry/console/commands/self/update.py
+2
-1
No files found.
src/poetry/console/commands/plugin/show.py
View file @
cb1c9fa0
...
...
@@ -27,10 +27,12 @@ class PluginShowCommand(Command):
command
:
SelfShowPluginsCommand
=
cast
(
SelfShowPluginsCommand
,
application
.
find
(
"self show plugins"
)
)
return
command
.
run
(
exit_code
:
int
=
command
.
run
(
IO
(
StringInput
(
""
),
self
.
_io
.
output
,
self
.
_io
.
error_output
,
)
)
return
exit_code
src/poetry/console/commands/self/self_command.py
View file @
cb1c9fa0
...
...
@@ -45,7 +45,7 @@ class SelfCommand(InstallerCommand):
@property
def
env
(
self
)
->
Env
:
if
self
.
_env
is
None
or
not
isinstance
(
self
.
_env
,
SystemEnv
):
if
not
isinstance
(
self
.
_env
,
SystemEnv
):
self
.
reset_env
()
return
self
.
_env
...
...
@@ -102,7 +102,7 @@ class SelfCommand(InstallerCommand):
The default implementations handles cases where a `self` command delegates
handling to an existing command. Eg: `SelfAddCommand(SelfCommand, AddCommand)`.
"""
return
super
()
.
handle
(
)
return
cast
(
int
,
super
()
.
handle
()
)
def
reset
(
self
)
->
None
:
"""
...
...
src/poetry/console/commands/self/show/__init__.py
View file @
cb1c9fa0
...
...
@@ -30,4 +30,5 @@ file.
if
self
.
option
(
"addons"
,
False
):
return
{
SelfCommand
.
ADDITIONAL_PACKAGE_GROUP
}
return
super
(
ShowCommand
,
self
)
.
activated_groups
groups
:
set
[
str
]
=
super
(
ShowCommand
,
self
)
.
activated_groups
return
groups
src/poetry/console/commands/self/show/plugins.py
View file @
cb1c9fa0
from
__future__
import
annotations
from
collections
import
defaultdict
import
dataclasses
from
typing
import
TYPE_CHECKING
from
typing
import
DefaultDict
from
poetry.console.commands.self.self_command
import
SelfCommand
if
TYPE_CHECKING
:
from
entrypoints
import
EntryPoint
from
poetry.core.packages.package
import
Package
@dataclasses.dataclass
class
PluginPackage
:
package
:
Package
plugins
:
list
[
EntryPoint
]
=
dataclasses
.
field
(
default_factory
=
list
)
application_plugins
:
list
[
EntryPoint
]
=
dataclasses
.
field
(
default_factory
=
list
)
class
SelfShowPluginsCommand
(
SelfCommand
):
name
=
"self show plugins"
description
=
"Shows information about the currently installed plugins."
...
...
@@ -32,13 +40,7 @@ commands respectively.
from
poetry.utils.helpers
import
canonicalize_name
from
poetry.utils.helpers
import
pluralize
plugins
:
DefaultDict
[
str
,
dict
[
str
,
Package
|
list
[
str
]]]
=
defaultdict
(
lambda
:
{
"package"
:
None
,
"plugins"
:
[],
"application_plugins"
:
[],
}
)
plugins
:
dict
[
str
,
PluginPackage
]
=
{}
system_env
=
EnvManager
.
get_system_env
(
naive
=
True
)
entry_points
=
PluginManager
(
ApplicationPlugin
.
group
)
.
get_plugin_entry_points
(
...
...
@@ -48,33 +50,42 @@ commands respectively.
system_env
,
with_dependencies
=
True
)
packages_by_name
=
{
pkg
.
name
:
pkg
for
pkg
in
installed_repository
.
packages
}
packages_by_name
:
dict
[
str
,
Package
]
=
{
pkg
.
name
:
pkg
for
pkg
in
installed_repository
.
packages
}
for
entry_point
in
entry_points
:
plugin
=
entry_point
.
load
()
category
=
"plugins"
if
issubclass
(
plugin
,
ApplicationPlugin
):
category
=
"application_plugins"
assert
entry_point
.
distro
is
not
None
package
=
packages_by_name
[
canonicalize_name
(
entry_point
.
distro
.
name
)]
plugins
[
package
.
pretty_name
][
"package"
]
=
package
plugins
[
package
.
pretty_name
][
category
]
.
append
(
entry_point
)
name
=
package
.
pretty_name
info
=
plugins
.
get
(
name
)
or
PluginPackage
(
package
=
package
)
if
issubclass
(
plugin
,
ApplicationPlugin
):
info
.
application_plugins
.
append
(
entry_point
)
else
:
info
.
plugins
.
append
(
entry_point
)
plugins
[
name
]
=
info
for
name
,
info
in
plugins
.
items
():
package
=
info
[
"package"
]
package
=
info
.
package
description
=
" "
+
package
.
description
if
package
.
description
else
""
self
.
line
(
""
)
self
.
line
(
f
" • <c1>{name}</c1> (<c2>{package.version}</c2>){description}"
)
provide_line
=
" "
if
info
[
"plugins"
]:
count
=
len
(
info
[
"plugins"
])
if
info
.
plugins
:
count
=
len
(
info
.
plugins
)
provide_line
+=
f
" <info>{count}</info> plugin{pluralize(count)}"
if
info
[
"application_plugins"
]
:
if
info
[
"plugins"
]
:
if
info
.
application_plugins
:
if
info
.
plugins
:
provide_line
+=
" and"
count
=
len
(
info
[
"application_plugins"
]
)
count
=
len
(
info
.
application_plugins
)
provide_line
+=
(
f
" <info>{count}</info> application plugin{pluralize(count)}"
)
...
...
src/poetry/console/commands/self/update.py
View file @
cb1c9fa0
...
...
@@ -50,10 +50,11 @@ environment.
if
self
.
option
(
"preview"
):
argv
.
append
(
"--allow-prereleases"
)
return
add_command
.
run
(
exit_code
:
int
=
add_command
.
run
(
IO
(
StringInput
(
" "
.
join
(
argv
)),
self
.
_io
.
output
,
self
.
_io
.
error_output
,
)
)
return
exit_code
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment