Compare commits

...
17 changed files with 1316 additions and 339 deletions
+1 -5
View File
@@ -17,8 +17,4 @@ jobs:
poetry install
- name: Lint
run: |
poetry run black src --check --diff
poetry run isort -c src
poetry run mypy src
poetry run ruff src
poetry run pyright src
poetry run poe lint
+33 -16
View File
@@ -1,16 +1,16 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Upload Python Package
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
on:
push:
tags: ["*"]
jobs:
deploy:
build:
name: Build distribution 📦
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Replace string
@@ -20,21 +20,38 @@ jobs:
string: ${{ github.ref_name }}
pattern: "v?([0-9][.][0-9][.][0-9]).*"
replace-with: "$1"
- name: Set up Python
uses: actions/setup-python@v2
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
python-version: 3.11
- uses: abatilo/actions-poetry@v2
- name: Build
run: |
cd stubs/setup
mkdir mobase-stubs
cp -r ../${{ steps.version.outputs.replaced }}/mobase-stubs/* mobase-stubs/
sed -i 's/__version__ = ".*"/__version__ = "${{ github.ref_name }}"/' mobase-stubs/__init__.pyi
python setup.py sdist bdist_wheel
twine upload dist/*
TAG=${{ github.ref_name }}
poetry version ${TAG#v}
poetry build
- name: Store the distribution packages
uses: actions/upload-artifact@v3
with:
name: python-package-distributions
path: stubs/setup/dist/
publish-to-pypi:
name: Publish Python 🐍 distribution 📦 to PyPI
needs:
- build
runs-on: ubuntu-latest
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v3
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
+241 -42
View File
@@ -114,6 +114,12 @@ mobase:
DATE:
LITERAL:
GameFeature:
__doc__: |
Base class for all game features, cannot be inherited, used only for typing
purpose in Python.
__abstract__: true
# TODO:
BSAInvalidation:
__doc__:
@@ -255,7 +261,7 @@ mobase:
type: str
desc: Full path to the file.
origins:
type: List[str]
type: list[str]
desc: |
List of origins containing providing this file. The first origin in the list
is the highest priority one (actually providing the file).
@@ -319,7 +325,7 @@ mobase:
__doc__: |
The parent tree containing this entry, or a `None` if this entry is the root
or the parent tree is unreachable.
type: Optional[IFileTree]
type: IFileTree | None
path:
__doc__: |
@@ -349,6 +355,141 @@ mobase:
The last extension of this entry, or an empty string if the file has no extension
or is directory.
IGameFeatures:
__doc__: |
Interface for the game features, accessible through IOrganizer.gameFeatures().
gameFeature:
__doc__: Retrieve the given game feature, if one exists.
abstract: false
args:
feature_type:
__doc__: The class of feature to retrieve.
type: Type[GameFeatureType]
returns:
__doc__: |
The game feature corresponding to the given type, or `None` if the feature is
not available.
type: GameFeatureType
registerFeature.1:
__doc__: |
Register game feature for the specified game.
This method register a game feature to combine or replace with other features
of the same kind. Some features are merged (e.g., ModDataContent,
ModDataChecker), while other override previous features (e.g., SaveGameInfo).
For features that can be combined, the priority argument indicates the order of
priority (e.g., the order of the checks for ModDataChecker). For other features,
the feature with the highest priority will be used. The features provided by the
game plugin itself always have lowest priority.
The feature is associated to the plugin that registers it, if the plugin is
disabled, the feature will not be available.
This function will return True if the feature was registered, even if the
feature is not used du to its low priority.
args:
games: Names of the game to enable the feature for.
feature: Game feature to register.
priority: |
Priority of the game feature. If the plugin registering the feature
is a game plugin, this parameter is ignored.
replace: |
If True, remove features of the same kind registered by the current plugin,
otherwise add the feature alongside existing ones.
returns: True if the game feature was properly registered, False otherwise.
registerFeature.2:
__doc__: |
Register game feature for the specified game.
This method register a game feature to combine or replace with other features
of the same kind. Some features are merged (e.g., ModDataContent,
ModDataChecker), while other override previous features (e.g., SaveGameInfo).
For features that can be combined, the priority argument indicates the order of
priority (e.g., the order of the checks for ModDataChecker). For other features,
the feature with the highest priority will be used. The features provided by the
game plugin itself always have lowest priority.
The feature is associated to the plugin that registers it, if the plugin is
disabled, the feature will not be available.
This function will return True if the feature was registered, even if the
feature is not used du to its low priority.
args:
game: Game to enable the feature for.
feature: Game feature to register.
priority: |
Priority of the game feature. If the plugin registering the feature
is a game plugin, this parameter is ignored.
replace: |
If True, remove features of the same kind registered by the current plugin,
otherwise add the feature alongside existing ones.
returns: True if the game feature was properly registered, False otherwise.
registerFeature.3:
__doc__: |
Register game feature for all games.
This method register a game feature to combine or replace with other features
of the same kind. Some features are merged (e.g., ModDataContent,
ModDataChecker), while other override previous features (e.g., SaveGameInfo).
For features that can be combined, the priority argument indicates the order of
priority (e.g., the order of the checks for ModDataChecker). For other features,
the feature with the highest priority will be used. The features provided by the
game plugin itself always have lowest priority.
The feature is associated to the plugin that registers it, if the plugin is
disabled, the feature will not be available.
This function will return True if the feature was registered, even if the
feature is not used du to its low priority.
args:
feature: Game feature to register.
priority: |
Priority of the game feature. If the plugin registering the feature
is a game plugin, this parameter is ignored.
replace: |
If True, remove features of the same kind registered by the current plugin,
otherwise add the feature alongside existing ones.
returns: True if the game feature was properly registered, False otherwise.
unregisterFeature:
__doc__: |
Unregister the given game feature.
This function is safe to use even if the given feature was never registered.
args:
feature: Feature to unregister.
returns: True if the feature was successfully unregistered, False otherwise.
unregisterFeatures:
__doc__: |
Unregister all features of the given type registered by the calling plugin.
This function is safe to use even if the plugin has no feature of the given type
register.
args:
feature_type:
__doc__: The class of feature to unregister.
type: Type[GameFeatureType]
returns: The number of unregistered features.
GamePlugins:
__abstract__: true
getLoadOrder:
@@ -665,7 +806,7 @@ mobase:
__doc__: |
The entry at the given location, or `None` if the entry was not found or
was not of the correct type.
type: Optional[Union[IFileTree, FileTreeEntry]]
type: IFileTree | FileTreeEntry | None
insert:
__doc__: |
@@ -1228,7 +1369,7 @@ mobase:
type: MoVariant
desc: The data that was included in the request.
result_data:
type: Dict[str, MoVariant]
type: dict[str, MoVariant]
desc: The data included in the response.
filesAvailable:
@@ -1244,7 +1385,7 @@ mobase:
type: MoVariant
desc: The data that was included in the request.
result_data:
type: List[ModRepositoryFileInfo]
type: list[ModRepositoryFileInfo]
desc: List of file information objects.
fileInfoAvailable:
@@ -1271,7 +1412,7 @@ mobase:
type: MoVariant
desc: The data that was included in the request.
result_data:
type: Dict[str, MoVariant]
type: dict[str, MoVariant]
desc: The data included in the response.
downloadURLsAvailable:
@@ -1293,7 +1434,7 @@ mobase:
type: MoVariant
desc: The data that was included in the request.
result_data:
type: Dict[str, MoVariant]
type: dict[str, MoVariant]
desc: The data included in the response.
endorsementsAvailable:
@@ -1476,6 +1617,9 @@ mobase:
pattern: The glob pattern to use to filter files.
returns: The list of matching files.
gameFeatures:
returns: The interface to the game features.
getFileOrigins:
__doc__: |
Retrieve the file origins for the specified file.
@@ -1531,17 +1675,36 @@ mobase:
modsPath:
returns: The (absolute) path to the mods directory.
onAboutToRun:
onAboutToRun.1:
__doc__: |
Install a new handler to be called when an application is about to run.
Multiple handlers can be installed. If any of the handler returns `False`, the application will
not run.
Multiple handlers can be installed. If any of the handler returns `False`, the
application will not run.
args:
callback: |
The function to call when an application is about to run. The parameter is the absolute path
to the application to run. The function can return False to prevent the application from running.
returns: True if the handler was installed properly (there are currently no reasons for this to fail).
The function to call when an application is about to run. The function
receives the absolute path to the application to run, the working directory
for the run and a string containing the arguments passed to the executable.
The function can return False to prevent the application from running.
returns: |
True if the handler was installed properly (there are currently no
reasons for this to fail).
onAboutToRun.2:
__doc__: |
Install a new handler to be called when an application is about to run.
Multiple handlers can be installed. If any of the handler returns `False`, the
application will not run.
args:
callback: |
The function to call when an application is about to run. The parameter
is the absolute path to the application to run. The function can return False
to prevent the application from running.
returns: |
True if the handler was installed properly (there are currently no reasons for
this to fail).
onFinishedRun:
__doc__: Install a new handler to be called when an application has finished running.
@@ -1549,7 +1712,19 @@ mobase:
callback: |
The function to call when an application has finished running. The first parameter is the absolute
path to the application, and the second parameter is the exit code of the application.
returns: True if the handler was installed properly (there are currently no reasons for this to fail).
returns: |
True if the handler was installed properly (there are currently no reasons for
this to fail).
onNextRefresh:
__doc__: Install a new handler to be called on the next refresh or immediately.
args:
callback: Function to call on the next refresh (or immediately).
immediate_if_possible: |
If True, immediately run the callback if no refresh is currently running.
returns: |
True if the handler was installed properly (there are currently no reasons for
this to fail).
onPluginDisabled.1:
__doc__: Install a new handler to be called when a plugin is disabled.
@@ -1951,9 +2126,11 @@ mobase:
See `IPlugin.init()` for more.
CCPlugins:
abstract: false
returns: The current list of active Creation Club plugins.
DLCPlugins:
abstract: false
returns: The list of esp/esm files that are part of known DLCs.
binaryName:
@@ -1962,38 +2139,24 @@ mobase:
dataDirectory:
returns: The path to the directory containing data (absolute path).
displayGameName:
abstract: False
returns: The name of the game to user for display, default to gameName().
documentsDirectory:
returns: The directory of the documents folder where configuration files and such for this game reside.
enabledPlugins:
abstract: false
returns: A list of plugins enabled by the game but not in a strict load order.
executableForcedLoads:
returns: A list of automatically discovered libraries that can be force loaded with executables.
executables:
abstract: false
returns: A list of automatically discovered executables of the game itself and tools surrounding it.
feature:
__doc__: Retrieve a specified game feature from this plugin.
abstract: false
args:
feature_type:
__doc__: The class of feature to retrieve.
type: Type[GameFeatureType]
returns:
__doc__: |
The game feature corresponding to the given type, or `None` if the feature is
not implemented.
type: GameFeatureType
featureList:
__doc__: |
Retrieve the list of game features implemented for this plugin.
Python plugin should not implement this method but `_featureList()`.
abstract: false
returns:
__doc__: A mapping from feature type to actual game features.
type: Dict[Type[GameFeatureType], GameFeatureType]
gameDirectory:
returns: The directory containing the game installation.
@@ -2001,15 +2164,17 @@ mobase:
returns: The icon representing the game.
gameName:
returns: The name of the game (as displayed to the user).
returns: The name of the game (for internal usage).
gameNexusName:
abstract: false
returns: The name of the game identifier for Nexus.
gameShortName:
returns: The short name of the game.
gameVariants:
abstract: false
__doc__: |
Retrieve the list of variants for this game.
@@ -2030,6 +2195,7 @@ mobase:
returns: An URL for the support page of this game.
iniFiles:
abstract: false
returns: |
The list of INI files this game uses. The first file in the list should be the
'main' INI file.
@@ -2057,6 +2223,7 @@ mobase:
returns: The list of game saves in the given folder.
loadOrderMechanism:
abstract: false
returns: The load order mechanism used by this game.
looksValid:
@@ -2065,6 +2232,11 @@ mobase:
directory: Directory to check.
returns: True if the directory looks like a valid installation of this game, False otherwise.
lootGameName:
abstract: False
returns: |
The game name to use when calling LOOT from MO2, default to gameShortName().
nexusGameID:
__doc__: |
Retrieve the Nexus game ID for this game.
@@ -2073,6 +2245,7 @@ mobase:
returns: The Nexus game ID for this game.
nexusModOrganizerID:
abstract: false
__doc__: |
Retrieve the Nexus mod ID of Mod Organizer for this game.
@@ -2081,9 +2254,11 @@ mobase:
returns: The Nexus mod ID of Mod Organizer for this game.
primaryPlugins:
abstract: false
returns: The list of plugins that are part of the game and not considered optional.
primarySources:
abstract: false
__doc__: |
Retrieve primary alternative 'short' names for this game.
@@ -2095,11 +2270,11 @@ mobase:
returns: The directory where save games are stored.
secondaryDataDirectories:
abstract: false
__doc__: |
Retrieve the list of secondary data directories. Each directories should be
assigned a unique name that differs from "data" which is the name of the main
data directory returned by dataDirectory().
returns: A mapping from unique name to secondary data directories.
setGamePath:
@@ -2122,9 +2297,11 @@ mobase:
variant: The game variant selected by the user.
sortMechanism:
abstract: false
returns: The sort mechanism for this game.
steamAPPId:
abstract: false
__doc__: |
Retrieve the Steam app ID for this game.
@@ -2341,6 +2518,16 @@ mobase:
True if the given file has a .esm extension, False otherwise or if the
file does not exist.
hasNoRecords:
__doc__: |
Determine if a plugin has no records.
args:
name: Filename of the plugin (without path but with file extension).
returns: |
True if the given file plugin contains no records, False if it does OR if the
file does not exist.
isLightFlagged:
__doc__: |
Determine if a plugin is flagged as light
@@ -2353,6 +2540,18 @@ mobase:
True if the given plugin is a light plugin, False otherwise or if the
file does not exist.
isOverlayFlagged:
__doc__: |
Determine if a plugin is flagged as overlay
This plugin flag was added in Starfield and signifies plugin records that
update existing records
args:
name: Filename of the plugin (without path but with file extension).
returns: |
True if the given plugin is an overlay plugin, False otherwise or if the
file does not exist.
hasLightExtension:
__doc__: |
Determine if a plugin has a .esl extension.
@@ -2798,7 +2997,7 @@ mobase:
filetree: The tree to try to fix. Can be modified during the process.
returns:
__doc__: The fixed tree, or a null pointer if the tree could not be fixed.
type: Optional["IFileTree"]
type: IFileTree | None
ModDataContent:
__doc__: |
@@ -3008,7 +3207,7 @@ mobase:
parent: The parent widget.
returns:
__doc__: A SaveGameInfoWidget to display information about save game.
type: Optional[ISaveGameInfoWidget]
type: ISaveGameInfoWidget | None
ScriptExtender:
__doc__:
@@ -3185,7 +3384,7 @@ mobase.widgets:
Display this dialog and wait for user-interaction to return. This is a blocking
function.
returns:
returns: |
The button clicked by the user. Without custom buttons, this return Ok,
otherwise it returns the button set in the TaskDialogButton.
Generated
+769
View File
File diff suppressed because it is too large Load Diff
+25 -31
View File
@@ -11,51 +11,45 @@ packages = [{ include = "mo2", from = "src" }]
mo2-stubs-generator = "mo2.stubs.generator.__main__:main"
[tool.poetry.dependencies]
python = "^3.11"
pyqt6 = "^6.5.2"
python = "^3.12"
pyqt6 = "^6.7.0"
pyyaml = "^6.0.1"
[tool.poetry.group.dev.dependencies]
black = "^23.9.1"
mypy = "^1.5.1"
pyright = "^1.1.327"
isort = "^5.12.0"
ruff = "^0.0.290"
flake8 = "^6.1.0"
flake8-black = "^0.3.6"
flake8-pyproject = "^1.2.3"
types-pyyaml = "^6.0.12.11"
pyright = "^1.1.365"
ruff = "^0.4.7"
types-pyyaml = "^6.0.12.20240311"
poethepoet = "^0.26.1"
[tool.poetry.group.doc.dependencies]
sphinx-rtd-theme = "^1.3.0"
sphinx-autodoc-typehints = "^1.24.0"
sphinx-rtd-theme = "^2.0.0"
sphinx-autodoc-typehints = "^2.1.0"
sphinx-automodapi = "^0.16.0"
sphinx = "^7.2.6"
sphinx = "^7.3.7"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
[tool.flake8]
max-line-length = 88
extend-ignore = ["E203"]
[tool.isort]
profile = "black"
multi_line_output = 3
[tool.poe.tasks]
format-imports = "ruff check --select I src --fix"
format-ruff = "ruff format src"
format.sequence = ["format-imports", "format-ruff"]
lint-ruff = "ruff check src"
lint-ruff-format = "ruff format --check src"
lint-pyright = "pyright src"
lint.sequence = ["lint-ruff", "lint-ruff-format", "lint-pyright"]
lint.ignore_fail = "return_non_zero"
[tool.ruff]
line-length = 88
target-version = "py311"
target-version = "py310"
[tool.mypy]
warn_return_any = true
warn_unused_configs = true
namespace_packages = true
[tool.ruff.lint]
extend-select = ["B", "Q", "I"]
[tool.ruff.lint.isort]
known-first-party = ['tas']
[tool.pyright]
# reportMissingTypeStubs = true
# reportUntypedBaseClass = false
typeCheckingMode = "strict"
reportMissingTypeStubs = true
+25 -15
View File
@@ -1,13 +1,12 @@
import argparse
import inspect
import logging
import subprocess
import types
from collections.abc import Sequence
from pathlib import Path
from typing import Callable
import black
import isort
from .loader import load_mobase
from .mtypes import Class, PyTyping
from .parser import is_enum
@@ -18,7 +17,9 @@ from .writer import Writer, is_list_of_functions
LOGGER = logging.getLogger(__package__)
def extract_objects(module: object, skips: list[str] = []) -> list[tuple[str, type]]:
def extract_objects(
module: object, skips: Sequence[str] = []
) -> list[tuple[str, type]]:
objects: list[tuple[str, type]] = []
assert hasattr(module, "__name__")
@@ -56,12 +57,9 @@ def add_mobase_header(writer: Writer):
"Callable",
"Dict",
"Iterator",
"List",
"Optional",
"overload",
"Sequence",
"Set",
"Tuple",
"Type",
"TypeVar",
"Union",
@@ -150,7 +148,7 @@ def main() -> None:
"IPlugin",
],
),
"mobase.widgets": extract_objects(getattr(mobase, "widgets")),
"mobase.widgets": extract_objects(mobase.widgets), # type: ignore
}
for name, objects in module_objects.items():
@@ -210,19 +208,31 @@ def main() -> None:
module_headers[name](writer)
for n, o in objects:
for n, _o in objects:
# Get the corresponding object:
c = register.get_object(n)
writer.print_object(c)
black.format_file_in_place(
output_folder.joinpath("__init__.pyi"),
fast=False,
mode=black.Mode(is_pyi=True),
write_back=black.WriteBack.YES,
subprocess.run(
[
"ruff",
"--silent",
"format",
output_folder.joinpath("__init__.pyi").as_posix(),
]
)
subprocess.run(
[
"ruff",
"--silent",
"check",
"--select",
"I",
"--fix",
output_folder.joinpath("__init__.pyi").as_posix(),
]
)
isort.api.sort_file(output_folder.joinpath("__init__.pyi"))
if __name__ == "__main__":
+11 -13
View File
@@ -1,6 +1,7 @@
from __future__ import annotations
import re
from collections.abc import Sequence
from typing import Final, TypeVar
@@ -164,7 +165,6 @@ class Argument:
class Exception:
"""
Small class representing exception that can be raised from functions.
"""
@@ -313,20 +313,20 @@ class Class:
self,
package: str,
name: str,
bases: list[Class],
methods: list[Method],
constants: list[Constant] = [],
properties: list[Property] = [],
inner_classes: list[Class] = [],
bases: Sequence[Class],
methods: Sequence[Method],
constants: Sequence[Constant] = [],
properties: Sequence[Property] = [],
inner_classes: Sequence[Class] = [],
doc: str = "",
):
self.package = package
self.name = name
self.bases = bases
self.methods = methods
self.properties = properties
self.constants = constants
self.inner_classes = inner_classes
self.bases = list(bases)
self.methods = list(methods)
self.properties = list(properties)
self.constants = list(constants)
self.inner_classes = list(inner_classes)
self.doc = ""
self.abstract = False
self.outer_class = None
@@ -385,7 +385,6 @@ class Class:
class PyClass(Class):
"""
Class use to wrap Python class to be used as parent class for some classes
in mobase.
@@ -401,7 +400,6 @@ class PyClass(Class):
class Enum(Class):
"""
Class representing an enum.
"""
+10 -7
View File
@@ -108,9 +108,12 @@ def parse_python_signature(s: str, name: str) -> tuple[PyType, list[Argument]]:
raise ValueError(f"invalid argument: {pa}, {s}")
matches = m.groupdict()
arguments.append(
Argument(matches["name"], PyType(matches["type"]), matches["value"])
)
type_ = matches["type"]
if matches["value"] == "None":
if "None" not in type_ and "MoVariant" not in type_:
type_ = type_ + " | None"
arguments.append(Argument(matches["name"], PyType(type_), matches["value"]))
return PyType(return_type), arguments
@@ -131,7 +134,6 @@ def is_enum(e: type) -> bool:
class Overload:
"""Small class to avoid mypy issues..."""
return_type: PyType
@@ -173,8 +175,8 @@ def parse_pybind11_function_docstring(e: type) -> list[Overload]:
try:
return_type, arguments = parse_python_signature(signature, e.__name__)
except ValueError:
raise ValueError(f"invalid signature: {e.__name__}, {e.__doc__}")
except ValueError as err:
raise ValueError(f"invalid signature: {e.__name__}, {e.__doc__}") from err
overloads.append(Overload(return_type=return_type, arguments=arguments))
return overloads
@@ -218,7 +220,8 @@ def make_class(e: type, register: MobaseRegister) -> Class:
# This contains ALL the parent classes, not the direct ones:
base_classes: list[Class] = [
register.make_object(name) for name in base_classes_s # type: ignore
register.make_object(name)
for name in base_classes_s # type: ignore
]
# retrieve all the attributes that are not in a base class
+4 -2
View File
@@ -220,7 +220,9 @@ class Settings:
f"mobase.{setting_name}."
)
for setting_arg, method_arg in zip(function_settings.args, fn.args):
for setting_arg, method_arg in zip(
function_settings.args, fn.args, strict=True
):
method_arg.doc = setting_arg.doc
if not setting_arg.type.is_none():
method_arg.type = setting_arg.type
@@ -371,7 +373,7 @@ class Settings:
)
for settings_arg, method_arg in zip(
function_settings.args, method_arguments
function_settings.args, method_arguments, strict=True
):
method_arg.doc = settings_arg.doc
if (
+3 -1
View File
@@ -74,6 +74,8 @@ class Writer:
sig_return_type = ""
if not fn.ret.type.is_none():
sig_return_type = " -> " + self._fix_typing(fn.ret.type.typing())
else:
sig_return_type = " -> None"
if isinstance(fn, Method):
if fn.is_static():
@@ -161,7 +163,7 @@ class Writer:
if not prop.is_read_only():
self._print("{}@{}.setter".format(indent, prop.name))
self._print(
"{}def {}(self, arg0: {}): ...".format(
"{}def {}(self, arg0: {}) -> None: ...".format(
indent, prop.name, self._fix_typing(prop.type.typing())
)
)
File diff suppressed because it is too large Load Diff
@@ -15,7 +15,7 @@ class TaskDialog:
def __init__(
self: TaskDialog,
parent: PyQt6.QtWidgets.QWidget = None,
parent: PyQt6.QtWidgets.QWidget | None = None,
title: str = "",
main: str = "",
content: str = "",
@@ -23,7 +23,7 @@ class TaskDialog:
icon: PyQt6.QtWidgets.QMessageBox.Icon = PyQt6.QtWidgets.QMessageBox.Icon.NoIcon,
buttons: List[TaskDialogButton] = [],
remember: Union[str, Tuple[str, str]] = "",
):
) -> None:
"""
Construct a new TaskDialog.
@@ -46,7 +46,7 @@ class TaskDialog:
button: Button to add to the dialog.
"""
...
def addContent(self: TaskDialog, widget: PyQt6.QtWidgets.QWidget):
def addContent(self: TaskDialog, widget: PyQt6.QtWidgets.QWidget) -> None:
"""
Add a custom widget content to this TaskDialog. Widget content are put between
content and buttons (above buttons).
@@ -61,7 +61,8 @@ class TaskDialog:
function.
Returns:
The button clicked by the user. Without custom buttons, this return Ok, otherwise it returns the button set in the TaskDialogButton.
The button clicked by the user. Without custom buttons, this return Ok,
otherwise it returns the button set in the TaskDialogButton.
"""
...
def setContent(self: TaskDialog, content: str) -> TaskDialog:
@@ -113,7 +114,7 @@ class TaskDialog:
title: Title of the dialog.
"""
...
def setWidth(self: TaskDialog, width: int):
def setWidth(self: TaskDialog, width: int) -> None:
"""
Set the width of the dialog.
@@ -145,7 +146,7 @@ class TaskDialogButton:
text: str,
description: str,
button: PyQt6.QtWidgets.QMessageBox.StandardButton,
):
) -> None:
"""
Create a TaskDialogButton.
@@ -160,7 +161,7 @@ class TaskDialogButton:
self: TaskDialogButton,
text: str,
button: PyQt6.QtWidgets.QMessageBox.StandardButton,
):
) -> None:
"""
Create a TaskDialogButton without description.
-21
View File
@@ -1,21 +0,0 @@
Copyright 2020 © Holt59
The MIT License (MIT)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
View File
+7
View File
@@ -0,0 +1,7 @@
# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand.
package = []
[metadata]
lock-version = "2.0"
python-versions = "^3.11"
content-hash = "81b2fa642d7f2d1219cf80112ace12d689d053d81be7f7addb98144d56fc0fb2"
+18
View File
@@ -0,0 +1,18 @@
[tool.poetry]
name = "mobase-stubs"
version = "v2.5.0.dev16"
description = "PEP561 stub files for the mobase Python API."
authors = ["Holt59 <capelle.mikael@gmail.com>"]
license = "MIT"
readme = "README.md"
packages = [{ include = "mobase-stubs" }]
homepage = "https://www.modorganizer.org/python-plugins-doc/"
documentation = "https://www.modorganizer.org/python-plugins-doc/"
repository = "https://github.com/ModOrganizer2/mo2-pystubs-generation"
[tool.poetry.dependencies]
python = "^3.11"
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
-69
View File
@@ -1,69 +0,0 @@
"""Python setup script.
:author: Stefan Lehmann <stlm@posteo.de>
:license: MIT, see license file or https://opensource.org/licenses/MIT
:created on 2018-10-06 10:55:36
:last modified by: Stefan Lehmann
:last modified time: 2019-07-23 10:27:04
"""
import io
import os
import re
from collections import defaultdict
from pathlib import Path
from setuptools import setup
def read(*names, **kwargs):
try:
with io.open(
os.path.join(os.path.dirname(__file__), *names),
encoding=kwargs.get("encoding", "utf8"),
) as fp:
return fp.read()
except IOError:
return ""
def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
def find_package_data(path: str):
package_data: dict[str, list[str]] = defaultdict(lambda: [])
for stubfile in Path(path).glob("**/*.pyi"):
package_data[stubfile.parent.as_posix().replace("/", ".")].append(stubfile.name)
return dict(package_data)
long_description = read("README.md")
package_data = find_package_data("mobase-stubs")
setup(
name="mobase-stubs",
url="https://github.com/ModOrganizer2/mo2-pystubs-generation",
author="Holt59",
author_email="capelle.mikael@gmail.com",
description="PEP561 stub files for the mobase python API",
long_description=long_description,
long_description_content_type="text/markdown",
version=find_version("mobase-stubs", "__init__.pyi"),
packages=list(package_data.keys()),
package_data=package_data,
install_requires=[],
python_requires="==3.11.*",
classifiers=[
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.11",
"License :: OSI Approved :: MIT License",
"Topic :: Software Development",
],
)