Browse Source

address pylint nits

shut-new-model
Niklas Rosenstein 9 months ago
parent
commit
80d47245ea
No known key found for this signature in database GPG Key ID: 6D269B33D25F6C6
13 changed files with 20 additions and 15 deletions
  1. + 1
    - 1
      src/shut/builders/__init__.py
  2. + 1
    - 1
      src/shut/builders/setuptools.py
  3. + 1
    - 1
      src/shut/checkers/__init__.py
  4. + 2
    - 2
      src/shut/commands/pkg/publish.py
  5. + 3
    - 3
      src/shut/model/author.py
  6. + 3
    - 2
      src/shut/model/version.py
  7. + 1
    - 1
      src/shut/publishers/__init__.py
  8. + 0
    - 0
      src/shut/publishers/core.py
  9. + 0
    - 0
      src/shut/publishers/warehouse.py
  10. + 1
    - 1
      src/shut/renderers/__init__.py
  11. + 3
    - 1
      src/shut/renderers/core.py
  12. + 1
    - 1
      src/shut/utils/cli.py
  13. + 3
    - 1
      src/shut/utils/type_registry.py

+ 1
- 1
src/shut/builders/__init__.py

@ -19,7 +19,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
from . import core, setuptools
from .core import *
from . import setuptools
__all__ = core.__all__

+ 1
- 1
src/shut/builders/setuptools.py

@ -27,7 +27,7 @@ from typing import Iterable, List, Optional
from shut.model import PackageModel
from shut.model.target import TargetId
from shut.utils.io.sp import subprocess_trimmed_call
from . import Builder, BuilderProvider, register_builder_provider
from .core import Builder, BuilderProvider, register_builder_provider
class SetuptoolsBuilder(Builder):

+ 1
- 1
src/shut/checkers/__init__.py

@ -24,7 +24,7 @@ The `shut.checkers` package implements all the sanity checks that are run over a
package definition to prevent common pitfalls and errors.
"""
from . import core, generic, monorepo, package
from .core import *
from . import generic, monorepo, package
__all__ = core.__all__

+ 2
- 2
src/shut/commands/pkg/publish.py

@ -30,8 +30,8 @@ from termcolor import colored
from shut.builders import get_builders
from shut.model import PackageModel
from shut.model.target import TargetId
from shut.publish import Publisher, get_publishers
from shut.publish.warehouse import WarehousePublisher
from shut.publishers import Publisher, get_publishers
from shut.publishers.warehouse import WarehousePublisher
from . import pkg
from .build import run_builds
from .. import project

+ 3
- 3
src/shut/model/author.py

@ -38,10 +38,10 @@ class Author:
def parse(cls, string: str) -> 'Author':
match = Author.AUTHOR_EMAIL_REGEX.match(string)
if not match:
raise ValueError('not a valid author string: {!r}'.format(s))
author = match.group(1).strip()
raise ValueError('not a valid author string: {!r}'.format(string))
name = match.group(1).strip()
email = match.group(2).strip()
return cls(author, email)
return cls(name, email)
def __str__(self):
return '{} <{}>'.format(self.name, self.email)

+ 3
- 2
src/shut/model/version.py

@ -35,6 +35,8 @@ class Version(_Version):
commit-distance and commit SHA suffix in the format of `-X-gY` (where
X is the distance and Y is the lowercase 7-character SHA sum). """
commit_distance: Optional[int]
def __init__(self, s: Union['Version', str]):
if isinstance(s, Version):
s = str(s)
@ -86,8 +88,7 @@ def parse_version(version_string: str) -> Version:
def bump_version(version: Version, kind: str) -> Version:
major, minor, patch, post = version.major, version.minor, version.micro, \
version.post
major, minor, patch, post = version.major, version.minor, version.micro, version.post
if kind == 'post':
if post is None:
post = 1

src/shut/publish/__init__.py → src/shut/publishers/__init__.py

@ -19,7 +19,7 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
from . import core, warehouse
from .core import *
from . import warehouse
__all__ = core.__all__

src/shut/publish/core.py → src/shut/publishers/core.py


src/shut/publish/warehouse.py → src/shut/publishers/warehouse.py


+ 1
- 1
src/shut/renderers/__init__.py

@ -24,7 +24,7 @@ This package implements rendering the files that can be produced from a monorepo
and package definition.
"""
from . import core, generic, setuptools
from .core import *
from . import generic, setuptools
__all__ = core.__all__

+ 3
- 1
src/shut/renderers/core.py

@ -20,13 +20,15 @@
# IN THE SOFTWARE.
import abc
from typing import Iterable, Generic, T, Type
from typing import Iterable, Generic, Type, TypeVar
from databind.core import datamodel
from shut.utils.io.virtual import VirtualFiles
from shut.utils.type_registry import TypeRegistry
T = TypeVar('T')
__all__ = [
'VersionRef',
'Renderer',

+ 1
- 1
src/shut/utils/cli.py

@ -42,7 +42,7 @@ def edit_text(text: str) -> str:
with nr.fs.tempfile('.yml', dir=os.getcwd(), text=True) as fp:
fp.write(text)
fp.close()
res = _editor_open(fp.name)
res = editor_open(fp.name)
if res != 0:
sys.exit(res)
with open(fp.name) as src:

+ 3
- 1
src/shut/utils/type_registry.py

@ -19,7 +19,9 @@
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
from typing import Iterable, Generic, T, Type
from typing import Iterable, Generic, Type, TypeVar
T = TypeVar('T')
class TypeRegistry(Generic[T]):

Loading…
Cancel
Save