Browse Source

address pylint -E nits

shut-new-model
Niklas Rosenstein 9 months ago
parent
commit
5d5c7b1e8b
No known key found for this signature in database GPG Key ID: 6D269B33D25F6C6
11 changed files with 15 additions and 14 deletions
  1. + 3
    - 1
      src/shut/builders/core.py
  2. + 2
    - 2
      src/shut/commands/changelog/__init__.py
  3. + 2
    - 2
      src/shut/commands/commons/new.py
  4. + 0
    - 4
      src/shut/commands/conda_forge.py
  5. + 1
    - 1
      src/shut/commands/mono/new.py
  6. + 2
    - 2
      src/shut/commands/pkg/new.py
  7. + 1
    - 0
      src/shut/commands/pkg/requirements.py
  8. + 1
    - 1
      src/shut/model/__init__.py
  9. + 1
    - 1
      src/shut/model/requirements.py
  10. + 1
    - 0
      src/shut/publishers/warehouse.py
  11. + 1
    - 0
      src/shut/renderers/setuptools.py

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

@ -20,7 +20,7 @@
# IN THE SOFTWARE.
import abc
from typing import Generic, Iterable, List, T, Type
from typing import Generic, Iterable, List, Type, TypeVar
from nr.stream import concat
@ -28,6 +28,8 @@ from shut.model import AbstractProjectModel
from shut.model.target import Target, TargetId
from shut.utils.type_registry import TypeRegistry
T = TypeVar('T')
__all__ = [
'Builder',
'BuilderProvider',

+ 2
- 2
src/shut/commands/changelog/__init__.py

@ -98,7 +98,7 @@ def changelog(**args):
# -e,--edit option was set.
if not entry.description or args['edit']:
serialized = yaml.safe_dump(to_json(entry, v3.Changelog.Entry, registry=registry), sort_keys=False)
entry = from_json(v3.Changelog.Entry, yaml.safe_load(_edit_text(serialized)), registry=registry)
entry = from_json(v3.Changelog.Entry, yaml.safe_load(edit_text(serialized)), registry=registry)
# Validate the entry contents (need a description and at least one type and component).
if not entry.description or not entry.component:
@ -129,7 +129,7 @@ def changelog(**args):
if not manager.unreleased.exists():
logger.error('no staged changelog')
sys.exit(1)
sys.exit(_editor_open(manager.unreleased.filename))
sys.exit(editor_open(manager.unreleased.filename))
changelogs = []
if args['version'] or not args['all']:

+ 2
- 2
src/shut/commands/commons/new.py

@ -21,7 +21,7 @@
import os
import subprocess
from typing import Optional
from typing import Any, Dict, Optional
import jinja2
import nr.fs
@ -64,7 +64,7 @@ def load_author_from_git() -> Optional[str]:
return Author(name, email)
def get_license_file_text(license: str) -> str:
def get_license_file_text(license: str, template_vars: Dict[str, Any]) -> str:
license_text = 'Copyright (c) {year} {author.name}\n\n'.format(**template_vars)
license_text += wrap_license_text(get_license_metadata(license)['license_text'])
return license_text

+ 0
- 4
src/shut/commands/conda_forge.py

@ -123,7 +123,3 @@ def update_feedstock(package_name, version, force):
print(f'pushing branch {s_branch_name} to {s_clone_url} ...')
git.push('origin', branch_name, force=force)
if __name__ == '__main__':
main()

+ 1
- 1
src/shut/commands/mono/new.py

@ -111,5 +111,5 @@ def new(
files.add_dynamic('README.md', render_template, README_TEMPLATE, template_vars)
files.add_dynamic('monorepo.' + suffix, lambda fp: dump(package_manifest, fp))
if license:
files.add_static('LICENSE.txt', get_license_file_text(license))
files.add_dynamic('LICENSE.txt', get_license_file_text, license, template_vars)
write_files(files, target_directory, force, dry)

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

@ -30,6 +30,7 @@ from termcolor import colored
from shut.commands.commons.new import (
load_author_from_git,
get_license_file_text,
render_template,
write_files,
GITIGNORE_TEMPLATE,
@ -40,7 +41,6 @@ from shut.model.author import Author
from shut.model.package import PackageModel, PackageData
from shut.model.requirements import Requirement, VersionSelector
from shut.model.version import Version
from shut.utils.external.license import get_license_metadata, wrap_license_text
from shut.utils.io.virtual import VirtualFiles
from . import pkg
@ -162,6 +162,6 @@ def new(
)
if license:
files.add_static('LICENSE.txt', get_license_file_text(license))
files.add_dynamic('LICENSE.txt', get_license_file_text, license, template_vars)
write_files(files, target_directory, force, dry)

+ 1
- 0
src/shut/commands/pkg/requirements.py

@ -22,6 +22,7 @@
import os
import shlex
import subprocess
import sys
from typing import Dict, List
import click

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

@ -21,7 +21,7 @@
import os
import sys
from typing import Any, List, T, TextIO, Tuple, Type, TypeVar, Union
from typing import Any, Dict, List, T, TextIO, Tuple, Type, TypeVar, Union
from databind.core import ConversionError, datamodel, field, Registry
from databind.json import from_json, to_json, registry as json_registry

+ 1
- 1
src/shut/model/requirements.py

@ -22,7 +22,7 @@
import re
from typing import Union
from databind.core import datamodel
from .version import Version
from .version import bump_version, Version
class VersionSelector(object):

+ 1
- 0
src/shut/publishers/warehouse.py

@ -20,6 +20,7 @@
# IN THE SOFTWARE.
import logging
import os
import sys
from typing import Iterable, List
from urllib.parse import urlparse

+ 1
- 0
src/shut/renderers/setuptools.py

@ -21,6 +21,7 @@
import collections
import contextlib
import json
import os
import re
import textwrap

Loading…
Cancel
Save